วันอังคาร, พฤษภาคม 23, 2549

Samba บน Solaris และ PostgreSQL บน Mac สำหรับ DSpace

จะลงแซมบ้า บนโซลาลิสเครื่อง lxx-xx16 มาหลายทีแล้ว แต่ว่ามีปัญหาหลายๆอย่าง จนกิ๊บอัพไปหลายครา คราวนี้เอาจริง คอมไพล์เอง ไม่ใช้จากแพคเกจแล้ว พอดีก็มีปัญหาอีกที่ว่า ไอ่ /usr/local มันถูกเมาท์โดย NFS ทำให้เราไม่อยากจะเข้าไปแก้ ก็เลยต้องลงใน $HOME/sys เอาละกัน
คำสั่งคอนฟิก

./configure --prefix=$HOME/sys/opt/samba --with-acl-support --with-quotas --with-included-popt --localstatedir=$HOME/sys/var/lib/samba --with-piddir=$HOME/sys/var/run --with-logfilebase=$HOME/sys/var/log/samba --with-privatedir=$HOME/etc/samba/private --with-configdir=$HOME/etc/samba
--with-ldap=no --with-ads=no
คอมไพล์ไม่ผ่าน สุดท้ายต้องใช้ package pkgadd -d samba...pkg.bz
มันจะติดตั้งไปที่ /opt/samba. เป็น Samba เวอร์ชั่น 3.0.22
samba-3.0.20a-1-noads-sunos5.9-sparc.pkg:
./configure --prefix=/opt/samba --with-acl-support --with-quotas --with-included-popt --localstatedir=/var/lib/samba --with-piddir=/var/run --with-logfilebase=/var/log/samba --with-privatedir=/etc/samba/private --with-configdir=/etc/samba --with-ldap=no --with-ads=no


ขั้นต่อมาแก้ /etc/samba/smb.conf เพิ่มส่วนที่ต้องการแชร์ลงไป ตัวอย่างเช่น
[myshare]
comment = My FileServer
path = /some/where/to/share
valid users = my_user_name
public = no
writable = yes
printable = no
create mask = 0700 or 0644
directory mask = 0700

---
create mask = 0644

The option create mask specifies and sets the necessary permissions according to the mapping from DOS modes to UNIX permissions. With this option set to 0644, all file copying or creating from a Windows system to the Unix system will have a permission of 0644 by default.

directory mask = 0755

The option directory mask specifies and set the octal modes, which are used when converting DOS modes to UNIX modes when creating UNIX directories. With this option set to 0755, all directory copying or creating from a Windows system to the Unix system will have a permission of 0755 by default.

และเพื่อความปลอดภัย อย่าลืม disable anonymous เพิ่มบรรทัดนี้เข้าไปในส่วน [global]
restrict anonymous = 2
client plaintext auth = no
---
ขั้นต่อมาก็เช็ค smb.conf ว่าโอมั้ย
# /opt/samba/bin/testparm

จากนั้นก็ต้องแก้ไข inetd เล็กน้อยเพื่อให้มัน start Samba daemons:

Most of Samba's services are provided by means of three servers or daemons: smbd is the Samba server, nmbd is the NetBIOS name server and swat is a Web-based Samba configuration tool. These deal with incoming connections on ports 137, 139 and 901 respectively and we need to tell the Solaris internet daemon, inetd, to start the appropriate Samba daemons whenever an incoming request is received on these ports.

Edit /etc/services and make the following changes.

Immediately after the line which reads:

sunrpc 111/tcp rpcbind
insert the two lines:

netbios-ns 137/udp # Samba nmbd
netbios-ssn 139/tcp # Samba smbd
and, after the line which reads:

ldaps 636/udp # LDAP protocol over TLS/SSL (was sldap)
insert the line:

swat 901/tcp # Samba swat
Now edit /etc/inetd.conf and add the following three lines to the end of the file:

netbios-ssn stream tcp nowait root /usr/local/samba/bin/smbd smbd
netbios-ns dgram udp wait root /usr/local/samba/bin/nmbd nmbd
swat stream tcp nowait.400 root /usr/local/samba/bin/swat swat
If you have TCP wrappers installed (see Installing and configuring TCP Wrappers on Solaris), the three lines to be added should read:

netbios-ssn stream tcp nowait root /usr/sbin/tcpd /usr/local/samba/bin/smbd smbd
netbios-ns dgram udp wait root /usr/sbin/tcpd /usr/local/samba/bin/nmbd nmbd
swat stream tcp nowait.400 root /usr/sbin/tcpd /usr/local/samba/bin/swat swat
Tell the inetd daemon to re-read its configuration file:

# pkill -HUP inetd
and Samba is installed and working.


ระวัง: ถึงแม้เวลาเรา ps -ef | grep smbd ดูโพรเสสแล้วไม่เจอ แล้วก็คิดว่ามันไม่เวิร์คตรงไหน?
จริงๆมันรันอยู่แล้ว เราต้องลอง connect เข้าไปดูถ้า connect ติดถึงจะมี smbd รันให้เห็นกะตา

นอกจากนี้เรายังสามารถให้ swat ได้ที่ http://localhost:901/ แต่ผมยังไม่ได้ลอง

เย่ สำเร็จ เท่านี้ก็มีไฟล์เซิร์ฟเวอร์ให้ถลุงแล้ว


ลง PostgreSQL ใน Mac OS X
อ้างอิงจาก: http://developer.apple.com/internet/opensource/postgres.html

เริ่มจากลง readline ใน Fink ด้วยคำสั่ง
$ sudo /sw/bin/fink install readline

แล้วก็ดาวน์โหลด postgresql มา ครั้งนี้เราโหลด 8.1.4 มา

./configure --prefix=$HOME/sys/usr/local/pgsql --with-includes=/sw/include --with-libraries=/sw/lib --enable-multibyte --enable-unicode --enable-locale --with-java --with-openssl --with-pam --with-bonjour
จากนั้นก็อาจจะ make check เพื่อความชัวร์ แต่ไม่จำเป็น install ได้เลยโดย make install

su -l postgres

$POSTGRESQL/bin/initdb -D $POSTGRESQL/data

Success. You can now start the database server using:

./bin/postmaster -D ./data
or
./bin/pg_ctl -D ./data -l logfile start
PostgreSQL ships with fairly lax access rules. If you’ll be using your
database in a production environment, or on any kind of shared server,
you should add at least a basic level of security. User authentication
rules are defined in the file /usr/local/pgsql/data/pg_hba.conf. As explained in the PostgreSQL documentation,
you can edit this file to password-protect user accounts, change
authentication methods for local and remote connections, and enable or
disable user access to various parts of the system.

# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD

host all postgres 127.0.0.1 255.255.255.255 md5
host samegroup all 127.0.0.1 255.255.255.255 md5
local all postgres md5
local samegroup all md5

After editing the file, I need to create a password for the “postgres” superuser, and restart the database server so the changes will take effect:

postgres@mail:~> psql test

test=# alter user postgres with password 'your_password';
test=# \q

For 8.0+, in postgresql.conf uncomment the line starting:

listen_addresses = 'localhost'

Then tighten up security a bit by editing pg_hba.conf and adding this line:

host dspace dspace 127.0.0.1 255.255.255.255 md5

# Jakarta Tomcat 4.x/5.x or equivalent, such as Jetty or Caucho Resin.

Note that DSpace will need to run as the same user as Tomcat, so you might want to install and run Tomcat as a user called 'dspace'. สำหรับกรณีนี้เราไม่

You need to ensure that Tomcat has a) enough memory to run DSpace and b) uses UTF-8 as its default file encoding for international character support. So ensure in your startup scripts (etc) that the following environment variable is set:

JAVA_OPTS="-Xmx512M -Xms64M -Dfile.encoding=UTF-8"

You also need to alter Tomcat's default configuration to support searching and browsing of multi-byte UTF-8 correctly. You need to add a configuration option to the element in [tomcat]/conf/server.xml:

URIEncoding="UTF-8"

e.g. if you're using the default Tomcat config, it should read:

URIEncoding="UTF-8" />

Jetty and Resin are configured for correct handling of UTF-8 by default.


DSpace Quick Installation Steps

First, a Word on Directories and Path Names

DSpace uses three separate directory trees. Although you don't need to know all the details of them in order to install DSpace, you do need to know they exist and also know how they're referred to in this document:

  • the source directory, referred to as [dspace-source]
  • the install directory, referred to as [dspace]
  • the web deployment directory. If you're using Tomcat, this will be [tomcat]/webapps/dspace (with [tomcat] being wherever you installed Tomcat--also known as $CATALINA_HOME). This directory is generated by the web server when it unpacks dspace.war, and should never be edited.
  1. Download the latest DSpace source code release and unpack it:

    gunzip -c dspace-source-1.x.tar.gz | tar -xf -
  2. Copy the PostgreSQL JDBC driver (.jar file) into [dspace-source]/lib. Download it directly from the PostgreSQL JDBC site. Make sure you get the driver for the version of PostgreSQL you're running and for JDBC2. เราลองใช้ JDBC3 ถ้าไม่เวิร์คเราจะกลับมาใช้ 2

  3. Create a dspace database, owned by the dspace PostgreSQL user:

    createuser -U postgres -d -A -P dspace ; createdb -U postgres -O dspace -E UNICODE dspace

    เราเปลี่ยนคำสั่ง createdb โดยให้ postgres ซึ่งเป็น DB admin ครีเอท เพราะไม่สามารถให้ dspace DB user create ได้โดยตรง

  4. As the dspace UNIX user, compile and install DSpace:

    cd [dspace-source] ; ant fresh_install

ติดตั้ง handle server
  1. Run /dspace/bin/dsrun net.handle.server.SimpleSetup /dspace/handle-server. Follow the instructions, answering relatively simple questions. Another option might be to run /dspace/bin/make-handle-config after configuring dspace.cfg, but we did not do this.
  2. Mail the file /dspace/handle-server/sitebndl.zip to hdladmin@cnri.reston.va.us. They will quickly create your global identifier and email you with the appropriate information.
  3. Once you receive the email, you must edit the Handle configuration file (/dspace/handle-server/config.dct). Just as the DSpace instructions say, เพิ่ม "storage_type" = "CUSTOM" และก็ "storage_class" = "org.dspace.handle.HandlePlugin" ลงไปในส่วนของ server_config.
  4. While still in config.dct, update any lines that say something like YOUR_NAMING_AUTHORITY with the appropriate number as sent to you in the email from the Handle admin people. For instance, here at UTK we have a line that reads "server_admins" = ( "300:0.NA/1785" ). We made this change in three places, under server_admins, backup_admins, and replication_admins.
  5. Edit /dspace/config/dspace.cfg, changing handle.prefix to whatever number you were assigned (in our case, the line reads handle.prefix = 1785), and changing if necessary handle.dir to point to the right place, usually /dspace/handle-server.
====================================================================
[echo] The DSpace code has been installed, and the database initialized.
[echo]
[echo] To complete installation, you should do the following:
[echo]
[echo] * Install the DSpace UI (dspace.war) and OAI-PMH (dspace-oai.war)
[echo] Web applications from the 'build' directory in the appropriate
[echo] place for your servlet container. e.g. '/opt/tomcat/webapps'
[echo]
[echo] * Make an initial administrator account (an e-person) in DSpace:
[echo]
[echo] /Users/jojo/sys/usr/local/dspace/bin/create-administrator
[echo]
[echo] * Start up your servlet container (Tomcat etc.)
[echo]
[echo] You should then be able to access your DSpace's 'home page':
[echo] https://bossanova.jaist.ac.jp:8080/dspace
[echo]
[echo] You should also be able to access the administrator UI:
[echo]
[echo] https://xxx.xxx.xxx.xxx:8080/dspace/dspace-admin
====================================================================



ปัญหา!!!!
สตาร์ทอัพ DSpace ไม่ได้เพราะเหมือนกับว่า หลังรันคำสั่งแล้วมันจะให้ใส่ passphrase ซึ่งไม่สามารถใส่ได้
ทางแก้: ลองใหม่โดยไม่ encrypt key ด้วย passphrase ก็จะสามารถสตาร์ทได้

== ไม่จำเป็นต้องติดตั้งใหม่ทั้งหมด ==
หลังจาก Handle-server เอย การ customize ไฟล์ input-forms.xml เอย ลงตัวแล้ว
เราสามารถเคลียร์ db เก่าโดยไม่ต้องลงใหม่ทั้งหมด (fresh_install) ด้วยการ:
1. ลบ dspace database ทิ้ง
2. ไปที่ [dspace-src] แล้ว $ ant setup_database && $ ant load_registries
3. ไปที่ [dspace] แล้ว $ ./bin/create-administrator

วันอาทิตย์, พฤษภาคม 14, 2549

Firefox Extensions

ที่ใช้อยู่ตอนนี้ก็มี
  1. Tab Mix Plus
  2. Mouse Gestures
  3. PDF download
  4. Down Them All
  5. Permit Cookies
  6. Flashblock
  7. Firefox Google Bookmarks

วันพฤหัสบดี, เมษายน 27, 2549

XSCF ของ PRIMEPOWER 250

config by execute /opt/FJSVmadm/sbin/madmin
แล้ว เราก็จะเห็น hostname, IP, ssh-enabled/disabled, web interface-enabled/disabled
จากนั้นก็ connect to the xscf console via ssh

วันพฤหัสบดี, มีนาคม 30, 2549

คำศัพท์ที่ใช้ในไวยากรณ์ภาษาญี่ปุ่น (Words used in Japanese Grammar)

Access Levels
JA TH
文法ไวยากรณ์
文
ประโยค
句
วลี
節
อนุประโยค
単語
คำศัพท์
修飾(しゅうしょく)
การขยายคำ (modify)


名詞
คำนาม
動詞
คำกริยา
助詞
คำบุพบท
副詞
คำวิเศษณ์
接続詞
คำสันธาน
数詞
คำบอกจำนวน
助数詞
คำลักษณะนาม
疑問詞
คำแสดงคำถาม


主語
ประธาน(หัวเรื่อง)
述語
ส่วนขยาย
目的語
กรรม
主題
หัวข้อเรื่องหลัก


肯定(こうてい)
บอกเล่า
否定
ปฏิเสธ
完了
สมบูรณ์
未完了
ไม่สมบูรณ์
過去
อดีต
非過去
ไม่อดีต

วันพุธ, มีนาคม 22, 2549

LaTeX package for typesetting books, reports

Memoir is a LaTeX package which has predefined primitives ex. chapter, page, caption and styles.
It can potentially help in typesetting a book.
I'm to check it later.

วันศุกร์, มีนาคม 10, 2549

Upgrade MediaWiki to 1.57 and Apache 2

หลังจากอัพเกรด Mac OS X ไปเป็น Tiger 10.4 แล้ว wiki ก็ไม่เวิร์ค วันนี้จะ troubleshoot แล้วก็เลย
ถือโอกาส อัพเกรดไปพร้อมๆกันเลย

รายละเอียดเริ่มอ้างอิงจากที่นี่
http://meta.wikimedia.org/wiki/Running_MediaWiki_on_Mac_OS_X

==== Apache 2 ====
download Apache 2 จาก http://www.serverlogistics.com/downloads.php
Files ต่างๆของ Apache 2 ถูกติดตั้งลงไปยัง /Library/Apache2 ไม่ทับ Apache ที่ติดมากับ OS
แต่ดั้งเดิม. นอกจาก start กับ stop แล้ว ยังมี graceful ที่ใช้เป็น parameter สำหรับ apachectl ได้
# /Library/Apache2/bin/apachectl {start,stop,graceful}
ลง preference pane เพิ่ม ได้ที่ /Library/PreferencePanes หรือ $HOME/Library/PreferencePanes เวลาจะ uninstall ก็อย่าลืมเอาออกด้วย

Preference pane ของ Apache 2 ที่ติดตั้งลงไปมันจะทำการเซตค่า APACHE2 ใน /etc/hostconfig
เพื่อกำหนดว่าจะให้ Apache 2 start ตอน boot หรือไม่
จะ uninstall ก็ลบไดเรคทอรี่เหล่านี้ออกซะ (อ้างอิง Install Guide ใน dmg installer file)

/Library/Apache2
/Library/StartupItems/Apache2
/Library/Receipts/Apache2.pkg



==== MySQL ====
MySQL เดี้ยงต้องจัดการก่อน เพราะเคยลง CompleteMySQL 4.0.21 ของ serverlogistics ไว้ แต่มันใช้กับ Tiger ไม่ได้?? หรือได้หว่า??

การลบ CompleteMySQL (อ้างอิงจาก Install Guide ที่อยู่ใน dmg installer file) ออกทำโดย:
- Backup databases ที่มีอยู่ทั้งหมดก่อน
- ลบ directory เหล่านี้
  • /Library/MySQL
  • /Library/StartupItems/MySQL
  • /Library/Receipts/MySQL.pkg
- หากต้องการ/จำเป็น ลบ mysql user ออกจากระบบด้วยก็
# sudo niutil -destroy . /users/mysql
- ลบ MySQL.prefPane ออกจาก /Library/PreferencePanes หรือ $HOME/Library/PreferencePanes


การติดตั้ง MySQL 5
(ดูเพิ่มเติม http://dev.mysql.com/doc/refman/5.0/en/upgrading-from-4-1.html)
- download mysql-standard-5.0.18-osx10.4-powerpc-64bit.dmg จาก
http://dev.mysql.com/downloads/mysql/5.0.html
- MySQL จะ install ไปที่ /usr/local/mysql-VERSION และทำ symbolic link ชี้มาจาก /usr/local/mysql
- หลัง install แล้วต้องทำ
- Install MySQLStartupItem.pkg ถ้าต้องการให้ MySQL start up automatically ตอน system
startup Startup Item for MySQL 5.0 is installed into
`/Library/StartupItems/MySQLCOM'. (Before MySQL 4.1.2, the location was
`/Library/StartupItems/MySQL)
- secure the default accounts หลังจากติดตั้ง MySQL เสร็จใหม่ๆ installer ของ Mac มันจะ initialize database ให้อยู่แล้ว (mysql_install_db) แต่ grant tables ที่มัน init มาให้จะไม่มี password ดังนั้นเราต้องเซต password ด้วยเพื่อความปลอดภัย
  • start MySQL server ด้วย คำสั่ง #sudo ./mysqld_safe [-u mysql] (ใน [...] optional)
  • ทดสอบ ด้วยคำสั่ง #sudo ./mysqlshow mysql
  • เซต password หรือลบ MySQL's anonymous account ออก และเซต password ให้ MySQL's root account. ข้อควรระวัง: มันมี anonymous account อยู่สองแบบ คือ ของ localhost กับของ host_name. ของ localhost มันจะมี privilege เท่า root ดังนั้นอันตราย ในครั้งนี้เราจะลบ anonymous account ทิ้งและเซตพาสเวิร์ดให้ root โดย
    • shell> mysql -u root
      mysql> DELETE FROM mysql.user WHERE User='';
      mysql> FLUSH PRIVILEGES;
    • shell> mysql -u root
      mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_pasword');
      mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('new_password');
    • ตรง User=''; นั้นเป็น single quote 2 อัน ไม่ใช่ double quote.
    • ถ้าจะเช็คให้แน่ใจว่า host_name ควรเป็นอะไร ใช้คำสั่ง
      mysql> SELECT Host, User FROM mysql.user;
  • ดูรายละเอียดจาก หน้านี้ http://dev.mysql.com/doc/refman/5.0/en/default-privileges.html

ปล. มี CocoaMySQL ที่เคยลงไว้ มันเป็น client เอาไว้ connect ไปจัดการกับ MySQL server แต่ CocoaMySQL ใช้กับ version 4.0.21 ได้ แต่ไม่สามารถใช้กับ version 5 ได้เพราะว่า password
encryption มันต่างกัน ต้องไปใช้ CocoaMySQL version beta0.7 ถึงเวิร์ค
- copy database ที่ dump ออกมาจากตัวเก่าไปยัง version ใหม่
(อ้างอิง: http://dev.mysql.com/doc/refman/5.0/en/upgrading-to-arch.html?ff=nopfpls)
  • shell> cat /some/where/dumped_db.mysql | mysql -u root -p db_name
หลังจาก upgrade จาก Panther ไปเป็น 10.4 Tiger แล้ว PHP communication with MySQL server มีปัญหาเพราะ socket ถูกย้ายด้วยเหตุผลทางด้าน security (อ้างอิง: http://docs.info.apple.com/article.html?artnum=301457, http://docs.info.apple.com/article.html?artnum=302977)
Mac OS X Server 10.4: Issues connecting PHP to MySQL (ลองดูใน script mysqld_safe ดูได้ว่ามันเรียกไปยัง /tmp/mysql.sock)

When running MySQL and PHP on the same Mac OS X 10.4 server, you may find that PHP cannot connect to MySQL. When PHP is communicating with a MySQL server on the same host, it uses a socket file to communicate, and looks for it at /tmp/mysql.sock. On Mac OS X Server 10.4, MySQL creates this socket file at /var/mysql/mysql.sock.

To resolve this issue, you can either change the location where MySQL creates its socket file, or modify the location where PHP looks for the file. Please note that the first option is less secure than the second. Before delving in, you should also review new information relevant to PHP and MySQL on Mac OS X Server 10.4.4 and later.

To change the location where MySQL creates its socket file, do this:

  1. Open your preferred text editor and create a plain text file.
  2. Type this text (on two lines as shown):

    [mysqld]
    socket=/tmp/mysql.sock


  3. Save the file as: /etc/my.cnf

To change the location where PHP looks for the socket file, follow these steps:

  1. In Terminal: sudo cp /etc/php.ini.default /etc/php.ini
  2. Open /etc/php.ini in your preferred text editor.
  3. Find the [MySQL] section, and change the mysql.default_socket directive:
         ; Default socket name for local MySQL connects.  If empty, uses
    the built-in
    ; MySQL defaults.
    mysql.default_socket = /var/mysql/mysql.sock

  4. Change the permissions on /var/mysql so that www can read the socket, by executing this in Terminal:

    sudo chmod 775 /var/mysql

การย้าย database
http://meta.wikimedia.org/wiki/How_to_move_a_MediaWiki_Database

An example command on how to dump the database on a Debian GNU/Linux machine using mysqldump:

mysqldump --user=USERNAME --password=PASSWORD --single-transaction --all-databases > BACKUPFILE.sql

dump database named "wikidb"

mysqldump -u root -B wikidb > wikidb.sql

restore database named "wikidb"

mysql -u root -B wikidb <>

Create user ใหม่ขึ้นมาบน MySQL database อันใหม่ที่เรา import เข้ามาแล้ว โดยใช้คำสั่ง GRANT
คำสั่ง GRANT จะ encrypt password ให้ดังนั้นไม่จำเป็นต้องเรียกใช้ PASSWORD('password')

mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
-> ON wikidb.*
-> TO 'wikiuser'@'localhost'
-> IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.05 sec)

bossanova:~/tmp/php-5.1.2 jojo$ ./configure '--prefix=/usr/local/php5.1.2' '--with-apxs2=/Library/Apache2/bin/apxs' '--with-ldap' '--with-kerberos' '--enable-cli' '--with-zlib' '--with-xml' '--enable-exif' '--enable-ftp' '--enable-mbstring' '--enable-mbregex' '--enable-sockets' '--with-iodbc' '--with-cure' '--with-config-file-path=/usr/local/php5.1.2/etc' '--with-mysql=/usr/local/mysql' '--with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-mysql-sock=/var/mysql/mysql.sock'



Compile Turck MMCache with your PHP

download ที่นี่ --> http://turck-mmcache.sourceforge.net/
วิธีการ compile ที่นี่ --> http://www.phpmac.com/articles.php?view=166

shell> /usr/bin/phpize
shell> ./configure --enable-mmcache=shared --with-php-config=/usr/bin/php-config

shell> make
shell> sudo make install


add below to the bottom of your php.ini (/usr/local/lib/php.ini <--ผิด
ที่ถูกคือ /etc/php.ini แต่มันยังมี /private/etc/php.ini ด้วย อันหลังนี้คิดว่าคงไม่ได้ใช้)
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20020429/mmcache.so"
mmcache.shm_size="16"
mmcache.cache_dir="/tmp/mmcache"
mmcache.enable="1"
mmcache.optimizer="1"
mmcache.check_mtime="1"
mmcache.debug="0"
mmcache.filter=""
mmcache.shm_max="0"
mmcache.shm_ttl="0"
mmcache.shm_prune_period="0"
mmcache.shm_only="0"
mmcache.compress="1"


รัน install จาก web เพราะลองรัน php จาก cli ดูแล้วมันไม่เวิร์ค
กรอกข้อมูลให้ถูกต้องเหมือนของเก่า แล้วก็ไปแก้ไฟล์ LocalSettings.php ที่ installer มัน generate
มาให้ โดยอ้างอิงจาก LocalSettings.php ของเก่า แก้ไปรีเฟรช browserใหม่ไปดู เท่านี้ก็เรียบร้อย

วันอังคาร, มีนาคม 07, 2549

การ setCellRenderer / setCellEditor ใน JTable

ใน JTable หนึ่งสมมุติว่าชื่อ tbl มันจะมี defaultRenderer / defaultEditor สำหรับ วาด / แก้ ข้อมูลใน field ตาม type ต่างๆ เช่น สำหรับ String หรือ Integer หรือ Boolean เป็นต้น.

ทีนี้เราสามารถ setCellRender / setCellEditor ในแบบ per-column-basis ได้ โดยมี idiom ดังนี้

TableColumnModel tcm = tbl.getColumnModel();
TableColumn tc = tcm.getColumn( columnIndex );
TableCellRenderer thisColumnRenderer = tc.getCellRenderer(); // อันนี้จะ return null ออกมา

เพราะว่า ถ้าเราไม่เซตเอง มันจะไปใช้ defaultRenderer ของ table ดังนั้น

นอกจากนี้แล้ว การใช้คำสั่ง {get,set}InputMap, {get,set}ActionMap ในการ assign action to keyStroke เพื่อให้, ตัวอย่างเช่น, key Enter มีพฤติกรรมเหมือน, tab key ได้

วันจันทร์, กุมภาพันธ์ 27, 2549

install / uninstall codec or filter files by regsvr32 command

see this page http://www.free-codecs.com/guides/How_to_install_uninstall_DLL_and_AX_files.htm

1. Unarchive the package and use the files from Release folder if you're running Windows 9x/Me or Release Unicode if you're running Windows 2000/XP.

2. Copy DLL or AX files in system32 folder [ C:\WINDOWS\system32 ]

3. Click on Start > Run...

• To install the files, type: regsvr32 filename.dll or regsvr32 filename.ax
• To uninstall the files, use: regsvr32 -u filename.dll or regsvr32 -u filename.ax

Run dialog box




4. In the end, you should receive a message saying that your file was succesfully installed/uninstalled.

The file was succesfully installed




An easy way to register/unregister [install/uninstall] the files is to use one of these small tools:
• RadLight Filter Manager - can be used to list all registered codecs and to register or unregister codecs.
• DirectShow Filter Manager: helps to list, sort, find, add or remove DirectShow filters.
• RegShell - a handy utility that will help you avoid the inconvenience of running regsvr32 from the start menu all the time.
• Emsa DLL Register Tool - register dll/ocx filters, codecs... and get extended file informations.



Some of the more common filters

• "iviaudio.ax" - WinDVD Audio Decoder filter.
• "ivivideo.ax" - WinDVD Video Decoder filter.
• "claud.ax" - PowerDVD Audio Decoder filter.
• "clvsd.ax" - PowerDVD Video Decoder filter.
• "DSCinemAudioDecoder.dll" - CineMaster v4 Audio Decoder filter.
• "DSCinemVideoDecoder.dll" - CineMaster v4 Video Decoder filter.

Note: Sometimes you need to specify the fully qualified path name to files (i.e. c:\program files\intervideo\common\bin\iviaudio.ax)

วันอาทิตย์, กุมภาพันธ์ 26, 2549

ลิ้งก์เกี่ยวกับ EPWING

แปะไว้กันหายเฉยๆ

http://hp.vector.co.jp/authors/VA021723/dessed/

http://openlab.jp/edict/

http://hp.vector.co.jp/authors/VA000022/unixdic/index.html

http://ebsnap.lkj.jp/

http://members2.jcom.home.ne.jp/babelkund/palm05.html

http://www.yo.rim.or.jp/~mono93/mobile/linuxzau/dic_able.html

วันจันทร์, กุมภาพันธ์ 20, 2549

เกี่ยวกับ Ubuntu, Kubuntu, KNOPPIX

เช็คเกี่ยวกับแต่ละตัวว่า เป็นมายังไง, เหมาะสำหรับทำอะไร, มีอะไรเป็นจุดน่าสนใจ...

--

OliveBSD : OpenBSD แบบ LiveCD

วันจันทร์, กุมภาพันธ์ 06, 2549

วันพุธ, มกราคม 18, 2549

Installing ESC/Java2 บน FreeBSD

Today's class was a little bit boring. In the last period, I have to get ESC/Java2 installed on my machine. The problem was I have jdk1.5 installed on my windows OS and the ESCJ is not happy to run on 1.5. I don't want to add jdk1.4 so I tried to put ESCJ on the FreeBSD box.
Here is the memo.

  1. Get the file by google for ESC/Java2
  2. Unpack it probably by 'tar jxf ESCJ-binary.tbz'
  3. Edit the script called escj. For the sake of safety, let's copy it to myescj and I edited myescj instead.
  4. What need to be defined are:
    1. export ESCTOOLS_RELEASE to the absolute path of the directory in which you placed the release files.
    2. export OSTYPE='linux'; I use linux library.
    3. export SIMPLIFY environment variable to the name of one of the Simplify.linux executables contained in $ESCTOOLS_RELEASE
    4. I need to branch the executable Simplify.linux to tell the FreeBSD that it is linux binary and please use Linux ABI to execute the file:
      • $ brandelf -t Linux Simplify.linux
    5. That's it. Try exercise the edited script with an example in examples/0.0/Bag.java
  • วันพฤหัสบดี, มกราคม 12, 2549

    ogg Vorbis and QuickTime & iTunes

    Today, I googled to see how to play the Vorbis ogg audio format with iTunes which relies on QuickTime. This isn't the first time of putting my effort to allow iTunes integration with Vorbis.
    The useful information is just at my nose, the official Vorbis site .

    Well, to summarize, I need the Xiph QuickTime extension component right at http://www.xiph.org/quicktime/ , a brother site of vorbis.com. Just install the component and he player will be ready to play the Vorbis audio file just fine.

    The only problem with this under-development-version is that the tag can't properly be edited by iTunes and the mandatory information like Artist or Title which appear correctly in Cog aren't properly dislayed. I hope this problem will be fixed up in the upcoming version of Xiph QT component. Anyway, thanks for great work.

    -- after further searching --
    I found a QT component for FLAC right here FLAC decoder for quick time .

    วันพฤหัสบดี, มกราคม 05, 2549

    Hamachi

    โปรแกรมสำหรับทำ VPN บน internet น่าสนใจเลยเอามาบล็อกไว้
    ้Hamachi

    วันศุกร์, ธันวาคม 09, 2548

    Java : ว่าด้วยเรื่อง Inheritance, Superclass, Subclass

    คำถามคาใจ:

    ในคลาสลูก การเรียก Constructor super() ของคลาสพ่อแบบ explicit กับการไม่เรียก
    ให้ผลต่างกันอย่างไร?

    การใช้ this กับไม่ใช้ this นั้นมีผลต่อ inheritance อย่างไร คือพอถูก subclass ไปแล้ว this ที่ในคลาสพ่อก็ยังคง refer ถึงตัวคลาสพ่ออยู่ดีใช่ป่าว?

    ทั้งหมดนี้น่าจะหาำคำตอบได้ใน Java Specification Book ไว้ว่างๆ ไปเช็คแล้วจะกลับมาตอบ

    วันพฤหัสบดี, ธันวาคม 01, 2548

    Java : Windows Font Look And Feel

    สำหรับ application ที่เจาะจงว่าจะรันบนวินโด้ โดยเฉพาะนั้น เพื่อให้รูปแบบของฟอนต์สอดคล้องกับของวินโด้แต่ดั้งเดิม ควรเลือกใช้ Tahoma ขนาดตั้งแต่ 12 - 15

    Java : เกี่ยวกับเรื่องของ ชิ้นส่วนภาชนะ Container Components

    ใน Swing นั้น, เรามี Top-level Container อยู่คือ JFrame, JDialog และ JApplet.
    สิ่งที่ควรสำเหนียก เวลาใช้พวก class เหล่านี้คือ
    • ทุก component ที่จะปรากฏบนจอ จะต้องอยู่ใน containment hierarchy---เป็นต้นไม้ของ component ซึ่งมี top-level container เป็นราก
    • ทุก GUI component ถูกยัดใส่ลงภาชนะ ได้แค่ครั้งเดียว. ถ้าเราเอา component ไหนยัดลงไปใน container หนึ่งแล้ว และจับมันยัดลงไปใน container อื่นอีก, ก็หมายความว่า มันต้องถูกเอาออกมาจาก container แรกก่อนจึงถูกนำไปยัดใส่ container ที่สองได้
    • ทุก top-level container มี content pane ซึ่งกล่าวอย่างคร่าวๆได้ว่า content pane นั้น บรรจุ visible components ใน GUI ของ top-level container ทั้งโดยตรงและโดยอ้อม.
    • เราสามารถเลือกที่จะใส่ menu bar ไปที่ top-level container หรือไม่ก็ได้. ซึ่ง menu bar นั้นจะถูกวางอยู่ภายใน top-level container, แต่อยู่นอก content pane. ในบาง look and feels, เช่น Mac OS look and feel, มีทางเลือกให้เราวางตำแหน่งของ menu bar ที่อื่นซึ่งเหมาะสมกว่าได้, เช่นที่ส่วนบนสุดของหน้าจอ เป็นต้น. ดังภาพข้างล่าง

    ตัวอย่างของ containment hierarchy ลำดับชั้นของภาชนะ













    Features ของ JComponent ที่น่านำไปใช้ในโปรแกรม
    1. Tool tips กำหนดข้อความโดย setToolTipText(), ช่วยบอกเวลา user เอาเมาส์มาวางไว้. ดูเพิ่มเติมได้ที่ How to Set the Look and Feel
    2. Support for layout ใน Component class แม้จะมี methods ซึ่งเอาไว้ดู layout hint เช่น getPreferredSize and getAlignmentX. ทางเลือกอื่นสำหรับ set layout hints, JComponent class เพิ่ม setter methods — setPreferredSize, setMinimumSize, setMaximumSize, setAlignmentX, and setAlignmentY. ขึ้นมา ดูเพิ่มที่ Laying Out Components Within a Container
    3. Key bindings ทำให้ components ตอบสนองเมื่อ user กดปุ่ม keyboard ที่กำหนดไว้. เช่นเวลาเคอร์เซอร์อยู่บนปุ่ม การกด space bar ก็เหมือนกับการกดคลิ๊กบนปุ่มนั้น. look and feel เซต bindings ของการกดและปล่อย ปุ่ม Space และส่งผลนั้นไปที่ปุ่ม. เพิ่มเติมเกี่ยวกับ key bindings ดูที่ How to Use Key Bindings (in the Creating a GUI with JFC/Swing trail).

    การใช้ Text Components
    Handling Events
    (see
    Writing Event Listeners (in the Creating a GUI with JFC/Swing trail) for details)
    Method Purpose
    void addMouseListener(MouseListener)
    void removeMouseListener(MouseListener)
    Add or remove a mouse listener (in the Creating a GUI with JFC/Swing trail) to or from the component. Mouse listeners are notified when the user uses the mouse to interact with the listened-to component.
    void addMouseMotionListener(MouseMotionListener)
    void removeMouseMotionListener(MouseMotionListener)
    Add or remove a mouse motion listener (in the Creating a GUI with JFC/Swing trail) to or from the component. Mouse motion listeners are notified when the user moves the mouse within the listened-to component's bounds.
    void addKeyListener(KeyListener)
    void removeKeyListener(KeyListener)
    Add or remove a key listener (in the Creating a GUI with JFC/Swing trail) to or from the component. Key listeners are notified when the user types at the keyboard and the listened-to component has the keyboard focus.
    void addComponentListener(ComponentListener)
    void removeComponentListener(ComponentListener)
    Add or remove a component listener (in the Creating a GUI with JFC/Swing trail) to or from the component. Component listeners are notified when the listened-to component is hidden, shown, moved, or resized.
    void setTransferHandler(TransferHandler)
    TransferHandler getTransferHandler()
    Set or remove the transferHandler property. The TransferHandler supports exchanging data via cut, copy, or paste to/from a clipboard as well a drag and drop. See Drag and Drop (in the Creating a GUI with JFC/Swing trail) for more details. Introduced in 1.4.
    boolean contains(int, int)
    boolean contains(Point)
    Determine whether the specified point is within the component. The argument should be specified in terms of the component's coordinate system. The two int arguments specify x and y coordinates, respectively.
    Component getComponentAt(int, int)
    Component getComponentAt(Point)
    Return the component that contains the specified x, y position. The top-most child component is returned in the case where components overlap. This is determined by finding the component closest to the index 0 that claims to contain the given point via Component.contains().

    อ้างอิง
    จาวา ติวโตเรี่ยล

    วันอังคาร, พฤศจิกายน 29, 2548

    Eclipse plug-in UML editors และ GUI builder

    บันทึกไว้กันลืม UML editors ที่ใช้วาด UML ลองหาๆ ดูจาก
    http://www.eclipseplugincentral.com
    แล้ว list มาดังนี้

    -- UML editors --
    • UMLet ที่ http://homepage.mac.com/martin.auer/umlet/ อันนี้ฟรี
    • SDE ที่ http://www.visual-paradigm.com/product/sde/ec/index.jsp อันนี้ commercials
    • EclipseUML ที่ http://www.eclipseuml.com/screenshot.html ฟรีำสำหรับ non-commercial
    -- GUI builder --
    • VE ที่ www.eclipse.org ฟรีแท้ๆ
    • Jigloo ที่ http://www.cloudgarden.com/jigloo/ ฟรีสำหรับ non-commercial

    วันจันทร์, พฤศจิกายน 21, 2548

    โปรแกรมฟรีแวร์ สำหรับ การเงินและการบัญชี Grisbi

    นึกอยากจะทำบัญชีส่วนตัวขึ้นมา เพื่อจะได้ควบคุมการใช้จ่ายเงินอย่างมีประสิทธิภาพ จะได้ควบคุมเงินออมไว้ลงทุน ก็เลยไปคุ้ยๆ หาฟรีแวร์ที่น่าจะใช้ได้มา ไปเจอใน FreeBSD ports
    จะหมู่หรือจ่าเดี๋ยวต้องไปลองก่อน เขียนโน้ตไว้เฉยๆ รายละเอียดอยู่ที่ Grisbi

    อื่นๆ
    gnucash
    finance/emma

    follow up: เท่าที่ลองดูแล้วคิดว่า GnuCash น่าใช้ที่สุด

    วันเสาร์, ตุลาคม 29, 2548

    เข้ารหัสเสียงให้เนียนๆ

    เกิดสงสัยอยากจะเข้ารหัสไฟล์เสียงแบบ ogg ให้รองรับ 5.1 channel หรือ 6 channel
    โดยแปลงจาก VOB หรือ AC3 จะทำอย่างไร. รวบรวมแหล่งข้อมูลไว้ดังนี้

    FAQ เกี่ยวกับ audio ครอบคลุมทุกเรื่อง ดีใช้ได้
    http://forum.doom9.org/showthread.php?s=&threadid=68300
    *ฟอรัมข้างบนกล่าวว่า การจะเข้ารหัส ogg แบบ 5.1 ch นั้นจำเป็นต้อง correct channel coupling
    ทำให้บิตเรตสูงและขนาดของไฟล์ผลลัพธ์จะมีขนาดเกือบเท่า AC3 ไฟล์ต้นฉบับ ดังนั้น ทำไม่คุ้ม

    ฺฺBeLight GUI สำหรับ Besweet ใช้ง่ายกว่าน่าลอง
    http://belight.corecodec.org/

    Audio guide ของ doom9
    http://www.doom9.org/index.html?/audio-guides.htm

    วันอังคาร, ตุลาคม 25, 2548

    ssh port forwarding

    เมื่อสัปดาห์ก่อนไปร่วม 研究会 ที่ 未来館 พักโรงแรมแล้วอยากจะส่งเมล์ขึ้นมาแต่มันส่งไม่ได้เพราะว่า
    ตั้งแต่เปลี่ยนมาใช้ FreeBSD ก็พึ่งจะอยากส่งเมล์จากนอกมหาลัยเป็นครั้งแรก
    ไม่รู้จะเซตยังไง เลยส่งผ่านเว็บไป.

    วันนี้มาค้นๆ ดู มีสองทางออก
    1. ใช้ SMTP ของ localhost เพราะว่า มันรัน Sendmail อยู่แล้ว
    2. ใช้ ssh port forwarding ผ่าน เฟ้ป
    สำหรับวิธีแรก ไม่ต้องกล่าวถึง ส่วนวิธีที่สองนั้นก็กล้วยๆ ทำดังนี้
    $ ssh -L 1025:วินเมล์:25 xoguy@เฟ้ป
    note:
    ต้องตั้ง SMTP เซตติ้งใน thunderbird ให้มันส่งไปที่พอร์ต 1025 ด้วย
    reference:
    http://www.ssh.com/support/documentation/online/ssh/adminguide/32/Port_Forwarding.html

    วันศุกร์, ตุลาคม 07, 2548

    Expocity: ทำ gnome windows changer ให้เป็นแบบ Mac

    วันนี้ลง Expocity เพื่อให้เปลี่ยนวินโด้แบบเท่ๆ อย่างแมค
    พอกด alt+tab ปุ๊บ มันจะขึ้นหน้าจอที่ย่อส่วนแล้วของทุกวินโด้มาให้เลือก

    ก่อนอื่นก็ pkg_deinstall -fv metacity ก่อน จากนั้นจึง
    portinstall -PPv expocity
    แล้วก็ startx เป็นอันเรียบร้อย

    วันพฤหัสบดี, ตุลาคม 06, 2548

    ติดตั้ง OpenOffice.org บน FreeBSD โดยใช้ package

    มีปัญหา ติดตั้งแล้วไม่เวิร์ค ลบทิ้งไปแล้ว ไว้แก้ได้แล้วจะมาโพสต่อ

    มาโพสต่อ ลงจาก OOopackages มันจะไม่เวิร์ค ต้องใช้ package จาก ftp.freebsd.org
    ก็รันคำสั่ง pkg_add -v openoffice.org-1.1.5 ธรรมดาตรงๆ ก็เรียบร้อย
    เลือกใช้ JVM ของ linux ไม่รู้ว่ามีผลรึเปล่า แต่ก็เอาวะเวิร์คก็พอละ

    ติดตั้ง ORBit-0.5.X จากแพคเกจก่อน แล้วก็ ดาวน์โหลด ไฟล์ package จาก ลิ๊งค์ข้างล่างนี้
    ftp://ooopackages.good-day.net/pub/OpenOffice.org/FreeBSD/1.1.5m57/FreeBSD5/

    ด้วย root permission รัน pkg_install
    # pkg_add -v OOo_1.1.5.20050705_FreeBSD54Intel_install.tbz
    # pkgdb -u

    ด้วย user permission เปลี่ยน dir ไปที่ home/Applications
    $ openoffice.org-1.1.5-m57
    เพื่อเรียก installer ขึ้นมา แล้วก็ตอบคำถามไปตามที่จำเป็น

    วันพุธ, กันยายน 07, 2548

    sig-alternative document class

    สำหรับเป็น Template มีคำสั่ง เฉพาะที่น่าจดน่าจำดังนี้
    • \centering
    • \begin{table} \centering \caption \begin{tabular}
    • \begin{table*}, \begin{figure*} สำหรับ กว้างคลุมทั้ง 2 คอลัมน์
    • \epsfig, \psfig
    • \newtheorem{theorem}{Theorem}
    • \newdef{definition}{Definition} ใช้กับ \begin{definition}
    • \secit ใช้ทำตัวเอียงสำหรับ text ที่อยู่ตรง section โดยเฉพาะ
    • \ttlit สำหรับ Title
    • proof environment, \begin{proof}

    วันจันทร์, กันยายน 05, 2548

    เปลี่ยนมาใช้ WindowMaker แทน Gnome

    How to switch to Thai keyboard layout in WindowMaker (or virtually any X11 window manager)
    GNOME มันเดี้ยงๆ มาตั้งหลายวันแล้ว ไม่รู้ทำไม ก็เลยคิดจะลองเปลี่ยนมาใช้ WindowMaker ดู
    แต่ว่ามีปัญหาเล็กน้อย คือติดเรื่อง การเปลี่ยนคีย์บอร์ดเลย์เอาท์ ภาษาไทย แต่วันนี้แก้ปัญหาได้แล้ว
    พึ่งรู้ว่ามันง่ายขนาดนี้ แค่เติม
    Option "XkbLayout" "us,th"
    Option "XkbOptions" "grp:alt_shift_toggle,grp_led:scroll"

    ลงไปก็เรียบร้อย ราบรื่น. รายละเอียดก็คือ บอกว่าจะใช้ keyboard layout แบบ us กับ th,
    แล้วก็ toggle layouts ด้วย alt+shift, ใช้ LED ของ scroll lock เป็นตัว indicator (ไฟติด
    คือใช้ layout ภาษาไทย)

    ไฟล์ xorg.conf ทั้งหมด ก็เป็นดังข้างล่างนี้
    ---------------------------------------
    Section "Files"
    RgbPath "/usr/X11R6/lib/X11/rgb"
    ModulePath "/usr/X11R6/lib/modules"
    FontPath "/usr/X11R6/lib/X11/fonts/WindowsFonts/"
    FontPath "/usr/X11R6/lib/X11/fonts/misc/"
    FontPath "/usr/X11R6/lib/X11/fonts/TTF/"
    FontPath "/usr/X11R6/lib/X11/fonts/Type1/"
    FontPath "/usr/X11R6/lib/X11/fonts/CID/"
    FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"
    FontPath "/usr/X11R6/lib/X11/fonts/100dpi/"
    EndSection
    Section "Module"
    Load "dbe"
    Load "dri"
    Load "extmod"
    Load "glx"
    Load "record"
    Load "xtrap"
    Load "freetype"
    Load "type1"
    EndSection
    Section "InputDevice"
    Identifier "Keyboard0"
    Driver "kbd"
    #### Thai Keyboard Switching config., Added by Chaiwat ####
    # Option "XkbRules" "xorg"
    Option "XkbLayout" "us,th"
    Option "XkbOptions" "grp:alt_shift_toggle,grp_led:scroll"
    EndSection
    # VMware SVGA



    Section "ServerFlags"
    # Option NoTrapSignals
    EndSection


    Section "InputDevice"
    Identifier "Mouse1"
    Driver "vmmouse"
    Option "Protocol" "SysMouse"
    Option "Device" "/dev/sysmouse"
    Option "ZAxisMapping" "4 5"
    # Option "Emulate3Buttons"
    # Option "Emulate3Timeout" "50"
    # Option "ChordMiddle"
    EndSection

    Section "Monitor"
    Identifier "vmware"
    VendorName "VMware, Inc"
    HorizSync 1-10000
    VertRefresh 1-10000

    ModeLine "640x480" 100 640 700 800 900 480 500 600 700
    ModeLine "800x600" 100 800 900 1000 1100 600 700 800 900
    ModeLine "1024x768" 100 1024 1100 1200 1300 768 800 900 1000
    ModeLine "1152x864" 100 1152 1200 1300 1400 864 900 1000 1100
    ModeLine "1152x900" 100 1152 1200 1300 1400 900 1000 1100 1200
    ModeLine "1280x1024" 100 1280 1300 1400 1500 1024 1100 1200 1300
    ModeLine "1376x1032" 100 1376 1400 1500 1600 1032 1100 1200 1300
    ModeLine "1400x1050" 100 1400 1500 1600 1700 1050 1100 1200 1300
    ModeLine "1600x1200" 100 1600 1700 1800 1900 1200 1300 1400 1500
    ModeLine "2364x1773" 100 2364 2400 2500 2600 1773 1800 1900 2000
    EndSection

    Section "Device"
    Identifier "VMware SVGA"
    Driver "vmware"

    EndSection

    Section "Screen"
    Identifier "Screen 1"
    Device "VMware SVGA"
    Monitor "vmware"

    # Don't specify DefaultColorDepth unless you know what you're
    # doing. It will override the driver's preferences which can
    # cause the X server not to run if the host doesn't support the
    # depth.

    Subsection "Display"
    # VGA mode: better left untouched
    Depth 4
    Modes "640x480"
    ViewPort 0 0
    EndSubsection
    Subsection "Display"
    Depth 8
    Modes "1376x1032"
    ViewPort 0 0
    EndSubsection
    Subsection "Display"
    Depth 15
    Modes "1376x1032"
    ViewPort 0 0
    EndSubsection
    Subsection "Display"
    Depth 16
    Modes "1400x1050"
    ViewPort 0 0
    EndSubsection
    Subsection "Display"
    Depth 24
    Modes "1400x1050"
    ViewPort 0 0
    EndSubsection
    EndSection

    Section "ServerLayout"
    Identifier "Simple Layout"
    Screen "Screen 1"
    InputDevice "Mouse1" "CorePointer"
    InputDevice "Keyboard0" "CoreKeyboard"
    EndSection

    วันอังคาร, สิงหาคม 30, 2548

    เวลา startx เข้า GNOME แล้วมี error message No volume control elements and/or devices found

    Refer from--> https://listman.redhat.com/archives/k12osn/2005-July/msg00646.html

    Les Mikesell wrote:
    On Thu, 2005-07-28 at 14:23, Eric Harrison wrote:

    The only way I can consistently eliminate this problem is by removing
    the mixer from the panel by default:

       rm -rf /etc/gconf/gconf.xml.defaults/apps/panel/applets/mixer



    After sleeping on it... "rm -rf" is a bit harsh, removing the
    read/write/execute permissions is much less destructive:

    chmod a-wrx /etc/gconf/gconf.xml.defaults/apps/panel/applets/mixer


    Is there any way to turn it into what you really want instead: either
    a window belonging to a local app running on the terminal or better
    yet a proxy that hooks to one when needed?

    วันจันทร์, สิงหาคม 29, 2548

    Enable DMA mode ใน FreeBSD

    เพิ่มส่วนนี้ลงไปใน /boot/loader.conf
    hw.ata.atapi_dma="1"
    hw.ata.ata_dma="1"

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

    mount_smbfs จาก FreeBSD ไปยัง Win2000 ไฟล์เซิร์ฟเวอร์

    mount_smbfs: can not setup kernel iconv table (default:tolower): syserr = Operation not permitted
    อ้างอิงได้จาก web นี้:
    http://www.onlamp.com/pub/a/bsd/2001/11/15/Big_Scary_Daemons.html

    ไปเจอกระทู้นึง มันบอกว่า
    which options did you include ?
    I think you need

    options LIBMCHAIN
    options LIBICONV

    as well as
    options NETSMB #SMB/CIFS requester

    and possibly

    options NETSMBCRYPTO #encrypted password support for SMB


    Someone please correct me if i'm wrong though, as i'm still pretty much a
    FreeBSD noob.

    > -----Original Message-----
    > From: Jan Karabas [mailto:karabas at savbb.sk]
    > Sent: 21 August 2003 11:41
    > To: freebsd-questions at freebsd.org
    > Subject: Samba & Iconv
    >
    >
    > Hi, I have one small problem with mounting drives of computers
    > with Winxxx.
    > If I want to mount some shared drive, mount_smbfs fails with this
    > message:
    >
    > bash-2.05b$ mount_smbfs //janci at NEDELA/TEMP ~/mnt/NEDELA/D
    > mount_smbfs: can not setup kernel iconv table
    > (default:tolower): syserr =
    > Operation not permitted
    >
    > How can I set up "kernel iconv table?". Maybe I forgot
    > something, when I
    > compiled my kernel...
    >
    > Help me please. Thanks
    >

    วันเสาร์, สิงหาคม 13, 2548

    FreeBSD printing

    อ้างอิงจาก http://www.engr.colostate.edu/~reinholz/freebsd/cups.htm
    http://www.linuxprinting.org/cups-doc.html

    1. แก้ไฟล์ /etc/make.conf
    • เพิ่ม สามบรรทัดนี้
    CUPS_OVERWRITE_BASE=yes
    NO_LPR=yes
    WITH_CUPS=yes
    เพื่อเซตเกี่ยวกับการ build package ต่างๆ ที่เกี่ยวกับ CUPS ในภายภาคหน้า

    2. install cups
    3. install gimp or gimp-print ด้วยการ make install clean จาก ports ไม่งั้นมันไม่มี driver มาให้
    $ sudo cp RIIC8103.PPD /usr/local/share/cups/model/
    ก๊อป Ricoh C8100 PPD driver จากของเครื่อง Mac OS X ไปไว้ใน cups driver directory
    * เพิ่มเติม สำหรับ Tiger (10.4) นั้นสามารถก๊อปได้จาก /etc/cups/ppd/xxxxx.ppd
    4. ไม่ต้องแก้ BrowseAddress ใน /usr/local/etc/cups/cupsd.conf
    5. start cupsd
    cd /usr/local/etc/rc.d
    cp cups.sh.sample cups.sh
    ./cups.sh start
    6. ชี้ browser ไปที่ http://localhost:631/
    7. เลือก Manage Printers
    8. ใส่ชื่อ แล้วเลือก LPD/LPR
    9. ใส่ชื่อ เป็น lpd://ps-printer-name เลือก driver ให้เหมาะสม
    10. Config printer ให้เหมาะสม เวลาสั่งพิมพ์ใช้คำสั่ง lpr -P

    * หมายเหตุ application ที่มันเบสบน Linux นั้นมันจะใช้ binary ที่ /compat/linux/usr/local/bin
    ซึ่งจะหา lp กับ lpr ไม่เจอ. ต้องทำลิ้งเอง

    link เกี่ยวกับจานดาวเทียม

    ได้มาจาก freemac.net เก็บไว้เผื่อใช้

    http://www.thaimisc.com/freewebboard/php/vboard.php?user=boranphone


    http://www.freewebs.com/boransat/

    http://thaisat.boxchart.com/

    http://www.lyngsat.com/asia.html

    FreeBSD: multilingual input ภาษาไทยและญี่ปุ่น

    สำหรับภาษาไทย
    แค่ไปเลือก Desktop > Preferences > Keyboard แล้ว เพิ่ม Keyboard layout ของ ภาษาไทยลงไป
    แล้วไปแก้ ค่าให้เปลี่ยน layout โดยใช้ Alt+Shift แทน
    สำหรับภาษาญี่ปุ่น
    ซับซ้อนกว่า
    1. Install anthy
    2. Install uim อันนี้ควรลงจาก ports เพราะต้องเลือก Anthy support option.
    3. ต้องไป enable Anthy โดย รัน uim-pref-gtk แล้วติ๊กเลือก Specific default IM แล้วเลือก
    Default input method เป็น Anthy

    สำหรับค่า ENVIRONMENT VARIABLE
    ใน .xinitrc เพิ่ม
    export GTK_IM_MODULE=uim-anthy
    export XMODIFIERS="@im=uim-anthy"
    uim-xim &
    exec gnome-session

    ใน .bashrc เพิ่ม
    LC_CTYPE=en_US.UTF-8
    LC_ALL=en_US.UTF-8
    LANG=en_US.UTF-8
    LANGUAGE=en_US.UTF-8

    FreeBSD: Install และ upgrade อย่างง่ายๆ ด้วย package

    เวลา make install จาก ports tree มันช้า เสียเวลาทำมาหากิน
    วิธีที่รวดเร็วกว่านั้นคือการใช้ portupgrade และ portinstall แทน

    • Install package ใหม่
      • $ portinstall -nPPvr
    • Upgrade package ที่มีอยู่แล้ว
      • $ portupgrade -nPPvr
    ข้อควรระวัง
    • ก่อนลง ด้วย package ควรดูก่อนว่า โปรแกรมที่เราจะลงนั้นมี option อะไรให้เลือกหรือเปล่า โดย
    เข้าไปดูที่ Makefile ว่ามี OPTIONS อะไรให้เลือกหรือเปล่า เพราะถ้าหากมีให้เลือก ควรลงด้วย ports
    แต่ถ้าไม่จำเป็นก็ลงเป็น package ไปจะง่ายกว่า
    • การลง package ที่เป็น localization เช่นของ japanese ports อย่าลืม ja- นำหน้าด้วย เช่นจะลง uimของ japanese ports ก็ต้อง portupgrade -nPPvr ja-uim ถ้าใช้ uim เปล่าๆ จะหาไม่เจอ

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

    Fonts Thai ทำอย่างไรให้ไม่อุบาทว์ ใน X11 FreeBSD 5.3

    ติดตั้งฟอนต์ไทยลงไปลองหลายวิธี แรกๆ ดูจากเว็บ อ.ชัชวาล แต่ว่ามันน่าเกลี๊ยด น่าเกลียด
    เลยเอาใหม่วะ ลองดู เคยทำได้นี่หว่า
    ผลลัพธ์ ออกมา โอเคเว๊ย ไม่เลว

    สรุปวิธีการดังนี้

    1. ก๊อปปี้ TrueType ฟอนต์ จาก Windows มา ที่ /usr/X11R6/lib/X11/fonts/WindowsFonts
    *หมายเหตุ ลองดูพวก user/group และก็ permission ให้ดีๆ ด้วยว่ามันโอมั้ย! จะให้ดี
    ควร run คำสั่งด้วย root จะไม่มีปัญหา

    2. cd เข้าไปที่ WindowsFonts สร้างไฟล์ scalable fonts "fonts.scale" ใช้คำสั่ง
    # ttmkfdir -o fonts.scale

    3. สร้างไฟล์ "encoding.dir" และ "fonts.dir" ใช้คำสั่ง
    # mkfontdir -e /usr/X11R6/lib/X11/fonts/encodings

    4. เพิ่ม FontPath ลงไป ใน /usr/X11R6/lib/X11/xorg.conf
    FontPath "/usr/X11R6/lib/X11/fonts/WindowsFonts"

    5. ดูให้แน่ๆว่าตรง Module มี Load "freetype" โหลดอยู่อ๊ะป่าว?

    6. startx เท่านี้ก็เรียบร้อย ได้ font สวยงาม มาใช้ แล้ว

    วันพุธ, สิงหาคม 03, 2548

    Line Tracer Car H8 JAIST team

    ไว้เขียนเปเปอร์เสร็จแล้ว จะทำ
    1. เพิ่ม sensor เป็น 2 จุุด.
    2. Decompose and rewrite MAIN_TASK to multi tasks.
    3. Use interrupt if possible.
    4. เขียน blog และอัพรูปขึ้นมาเก็บไว้เตือนค.จำ

    วันจันทร์, สิงหาคม 01, 2548

    วันนี้เกิดไอเดีย กระจายเสียงแบบ wireless IEEE 802.11a/b/g

    เพราะคอมเจ๊งเนี่ยแหละ ไอ่เครื่องที่ปกติเอาไว้เปิดเพลงก็เลยใช้ไม่ได้
    อืม ลง iTunes ที่เครื่อง Fujitsu ไว้ แต่มันก็เคลื่อนย้ายลำบาก เลยคิดว่า
    น่าจะมี อะไรที่ทำให้มันไปออกลำโพงได้เป็น wireless นะ
    ค้นดูที่ apple's site อ่าว มันก็มีผลิตภัณฑ์ คือ AirPort Express เป็น
    อย่างที่เราต้องการเดี๊ยะเลยนี่หว่า ราคา ประมาณ 14,000 เยน

    อืม ไว้ wireless station ที่ใช้เจ๊งเมื่อไหร่จะเปลี่ยนเป็นอันนี้ละกันนะ
    แต่จริงๆก็อยากได้ ถ้าไอ่ T-Engine ที่ตั้งทิ้งไว้อยู่นั่น เอามาพัฒนา
    เป็น AirTunes ได้ก็เยี่ยมเลยเพราะมันมี PC-Card slot เสียบ wireless
    card ของ Buffalo ได้พอดี แล้วมันก็เหมือนจะมี mp3 decoder เป็น
    hardware อยู่ด้วย adapter แปลง หัวเสียบ jack ก็ซื้อมาแล้ว
    มีเวลาเมื่อไหร่จะลองทำดู

    วันศุกร์, กรกฎาคม 29, 2548

    FireFox Extensions ที่น่าสนใจ

    ขาดไม่ได้เลยอันนี้
    1. Mouse Gestures
    2. Tab Mix ถ้าเป็น Mac OS X ก็ให้ใช้ Tab Mix Plus
    3. FlashGot
    4. Down Them All

    สลับปุ่ม Ctrl กับ Caps Lock

    เพิ่มส่วนนี้เข้าไปใน registry
    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
    "Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00

    Config TeXlipse

    หมายเหตุ MikTeX เป็นอีก Implementation หนึ่งของ LaTeX ที่น่าสนใจ
    ถ้าไม่คิดเรื่องภาษาญี่ปุ่น

    options และค่าต่างๆ ที่ต้องตั้งเวลาลง TeXlipse
    • Builder Settings: หากเราเซต PATH environment variable ของ user ให้มี TeX/bin และ อื่นๆซึ่งหาดูได้จาก อ้างอิง แล้วล่ะก็ TeXlipse จะหาค่าต่างๆ ได้เอง ยกเว้น ps2pdf ซึ่งเป็นของ Ghostscript
      • Ps2pdf program () ให้ใส่ค่า $GHOSTSCRIPT_PATH\lib\ps2pdf.bat
        • Arguments ใส่ค่า -dPDFsettings=/prepress %input
    • Viewer Settings: ต้องตั้งค่าบางอย่างสำหรับพวก viewer ตามนี้
      • acroread (C:\Program Files\...\AcroRd32.exe) ตั้ง path ของ Acrobat Reader
      • gv (C:\Program Files\Ghostgum\gsview\gsview32.exe) ตั้ง path ของ Ghostview
      • dviout (D:\bin\dviout\dviout.exe) แล้วเลือก file type เป็น dvi [อันนี้ต้องเพิ่มเอาเอง เพราะมันไม่ได้มีอยู่ใน default list]
    อ้างอิง
    1. เกี่ยวกับ Ghostscript
    2. เกี่ยวกับ TeX

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

    XP Home to XP Pro

    C'T writes in its latest print issue (in German only) that you need to copy the root directory and the i386 directory of the WindowsXP CD to your harddisk, extract the Bootsector of your WindowsXP CD and change only 2 bytes in i386Setupreg.hiv by using Regedit. In fact all you have to do is edit the binary key "default" and change "01" to "00" and "02" to "00" in HKEY_LOCAL_MACHINEHomekeyControlSet001Servicessetupdd, C'T claims.

    There is one big drawback, though. Users won't be able to install Service Pack 2, unless they integrate SP2 in the installation CD. And that's probably too much trouble for most users, who of course are better off buying a legal version anyway. It is expected that Microsoft will change the setup files soon to prevent this hack. "

    วันอังคาร, กรกฎาคม 26, 2548

    Mac OS X Login Hook and Logout Hook

    เวลาต้องการรัน startup สคริปต์ตอนล็อกอิน หรือ ล็อกเอาท์ใน
    MacOS X มี ระบบซึ่งเรียกว่า Login Hook และ Logout Hook
    อ้างอิงจากอันนี้ดีที่สุด หน้านี้ และ หน้านี้
    วิธีใหม่
    sudo defaults write com.apple.loginwindow LoginHook /path/to/script

    (where /path/to/script is the full path to the script that you want to execute when a user logs in—it doesn't have to be in the user's Home directory).

    This modifies the /var/root/Library/Preferences/com.apple.loginwindow file.


    วิธีเก่า
    หลักๆแล้วก็คือ แก้ /private/etc/ttys โดยเพิ่ม
    -LoginHook /private/mydir/myLoginHookScript -LogoutHook /private/mydir/myLogoutHookScript

    เพิ่มระหว่าง console "/System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow
    -LoginHook /private/mydir/myLoginHookScript -LogoutHook /private/mydir/myLogoutHookScript vt100 on secure windows=...

    วันจันทร์, กรกฎาคม 25, 2548

    LaTeX กับ Mac OS X

    วันนี้ลองคุ้ยๆใน google ดูเกี่ยวกับ LaTeX บน Mac OS X ว่าลงอันไหนน่าจะดี
    แหล่งข้อมูลที่น่าสนใจก็มี
    สรุปได้ว่า i Installer ของ R&A น่าจะดีสุด
    สำหรับตัวฟรอนท์เอนด์น่าจะลอง LyX กับ TeXShop

    ปล. ลิ้งเกี่ยวกับ Mac OS X ในส่วนของ unix น่าสนใจดี

    วันเสาร์, กรกฎาคม 16, 2548

    แสดงภาษาไทยและญี่ปุ่นใน xterm ของ Mac OS X แบบ そのまま

    จริงๆ แล้วไม่ต้องใช้ iTerm ก็ สามารถ แสดงภาษาไทยบน xterm ของ Mac OS X ได้
    เวลาเรียก ให้เรียก uxterm แทน มันเป็น wrapper เอาไว้ห่อ xterm -u8 ซึ่งสำหรับ
    รองรับ UTF-8.
    เวลา ls ให้ใช้ ls -v แทน หรือจะทำเป็น alias ไว้ก็จะดี จะสามารถแสดงภาษาไทยและ
    ญี่ปุ่นได้เลย ไม่ต้องยุ่งยาก. ส่วนการ input ที่ terminal นั้นก็สามารถ input ภาษาไทย
    ได้เลย เนื่องจากว่า input method สำหรับภาษาไทยของ Mac นั้นเป็น Unicode อยู่แล้ว
    แต่สำหรับภาษาญี่ปุ่นนั้นมันเป็น IM เฉพาะของมัน และ(คาดว่า) ไม่เป็น Unicode เพราะ
    เวลาใส่อินพุตภาษาญี่ปุ่น ลงไปแล้วมันเป็นขยะไป

    คาดว่าวิธีแก้สำหรับภาษาญี่ปุ่นนันน่าจะเป็นการใช้ input method สำหรับ unix เช่น kanna2
    หรือว่า anthy เป็นต้น. ขี้เกียจลอง

    วันศุกร์, กรกฎาคม 15, 2548

    iTerm กับ terminal ที่เป็น Unicode

    วันนี้ลองใช้ iTerm อีกครั้ง หลังจากคราวที่แล้วใช้งานแล้วมันไม่เวิร์ค
    เหตุที่ทำให้กลับมาใช้อีกครั้งก็เพราะ 7-zip ฉบับ Mac OS X มันออกมาเฉพาะ
    command-line version เท่านั้น ก็เลยต้องใช้กับ Terminal แต่ทีเด็ดของเจ้า
    7-zip เนี่ยมันอยู่ตรงที่มัน fully support unicode filename ก็เลยทำให้เราสามารถ
    บีบอัดทั้งไฟล์ทั้งโฟลเดอร์ที่ตั้งชื่อเป็นภาษาไทย (ซึ่งส่วนมากก็คือไอ่เพลงที่อยู่ใน
    auditorium ของเรานั่นเอง) และภาษาญี่ปุ่นได้
    โอ้ัโฮ ไอ่เราอยากได้มาันานแล้วไอ่โปรแกรมอย่างงี้
    มีเรื่องปวดหัวหลายๆ ทีแล้ว ไอ่เรื่องชื่อไฟล์แบบ อินเตอร์แนชั่นแนล เนี่ย

    เข้าพ้อยท์สำคัญเลยดีกว่า ที่มันแสดงชื่อไฟล์ภาษาไทยและญี่ปุ่นไม่ได้เวลาสั่ง ls เนี่ย
    เพราะเราไม่ได้ set environment variable ที่สำคัญไปตัวหนึ่งซึ่งก็คือเจ้า LANG
    $ export LANG=en_US.UTF-8 ปุ๊บก็จะแสดงได้ทันที

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

    ลง มีเดียวิกิ บนเครื่อง bossanova Mac OS X G5 dual เรียบร้อยแล้ว

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

    วันศุกร์, กรกฎาคม 08, 2548

    ลองลง Skippy แล้วมันไม่เวิร์ค

    Skippy เป็นซอฟต์แวร์ตัวหนึ่งที่ช่วยให้ x11 windows manager เปลี่ยนหน้าต่างไปมา
    ได้เหมือน Expose (tm) ของ Mac OS X

    วันอังคาร, มิถุนายน 28, 2548

    耳のことなんだけど。。。

    耳に関するいろいろなことばがある。意味は大体聞くこととか聞こえることを表現するが、微妙に違うところもある。
    • 耳を澄(す)ます:何かを聞こうと思って注意してじっと聞く。
    • 耳につく:聞こえた音が気になって、耳から離れないような感じになる。
    • 耳が遠い:聞く力が弱っていて、よく聞こえない。
    • 耳を傾(かたむ)ける:何かを聞こうと思って、他人の話などを真剣に聴く。
      • 例)先生のアドバイスに耳を傾けた。
    * 「聞く」と書くより、態度がとても熱心な場合は「聴く」という漢字を使う。

    ...やか、「やか」が付くことば。

    最近、歌を聴いたりドラマを観たりするとき、よく出てくる形容詞は、なんとか「○○やか」が多いなぁと気がついた。เกือบทั้งหมดเป็นคำ ๔ พยางค์なので結構気になる。今後、注意して聞こうと思っているんだ。そして、
    このblogに記述するように。

    • 賑(にぎ)やか:これはもちろん最初日本語習った頃に知った言葉だ。
    • 健(すこ)やか:
    • 密(ひそ)やか:
    • 穏(おだ)やか:
    • 細(ささ)やか:tiny,small,modest
    • 爽(さわ)やか:fresh,refreshing
    • 豊(ゆた)やか:豊かなさま、ゆったりしたさま。
    • 緩(ゆる)やか:緩いさま。ゆとりのあるさま。動きなどがゆっくりしているさま。
    • 鮮(あざ)やか:ものの色彩・形などがはっきりしていて、目立つさま。

    วันจันทร์, มิถุนายน 27, 2548

    Mac OS X remote desktop จาก Windows XP

    ใช้ซอฟต์แวร์ที่เรียกว่า VNC ของทีมวิจัย AT&T ที่เคมบริดจ์
    http://www.realvnc.com/
    ทางฝั่ง Mac ให้ติดตั้งซอฟต์แวร์ OSXvnc
    เป็นฝั่ง server ทางด้านฝั่ง Windows XP ให้ติดตั้ง VNCviewer
    เป็นฝั่ง client แล้วก็เปิด firewall ของทางฝั่งแมคให้ port 5900 ใช้งานได้
    แค่นั้นก็เรียบร้อย ใช้งานได้ เจ๋ง!!

    วันเสาร์, มิถุนายน 25, 2548

    พ้อยโตะของเจซีบีเอาไปทำอะไร?

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

    ที่น่าสนใจและคุ้มๆหน่อยก็น่าจะเป็นแลกเป็นพ้อยของ "บิ๊กคาเมร่า" หรือไม่ก็ "ระคุเต็ง"
    ของบิ๊กนี่มีแต้มเหลืออยู่พันกว่าๆ แลกมารวมกันน่าจะได้ซัก สี่พัน อืม ไม่เลวๆ.
    แต่ของที่อยากได้ตอนนี้ที่บิ๊กคาเมร่าไม่มี คงต้องแลกเป็นของระคุเต็งแทน
    อืม รวมกับพ้อยที่ได้รับมาจากอนาก็เป็นสี่พันเหมือนกัน ไม่เลวๆ ซื้อกระเป๋าใบนั้นที่อยากได้
    ลงตัวคัมเปกิ

    * แต่ถ้าเป็นของทสุมิโตะโมะ แลกเป็นไมล์ของอนาจะคุ้มกว่ามันแลกได้ 10 ไมล์ ต่อพอยท์
    ได้เยอะกว่าพวกของระคุเต็งหรือบิ๊กสองเท่า

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

    ค้นหา ebook ในกูเกิ้น

    Using the google advanced operators:

    If you don't know what are the google advanced operators, visit this page:

    CODE
    http://www.googleguide.com/advanced_operators.html


    ------------------


    Querys to insert in the search box of google:

    Query:
    +("index of") +("/ebooks"|"/book") +(chm|pdf|zip|rar) +apache


    Finding particular eBooks:

    Query:
    allinurl: +(rar|chm|zip|pdf|tgz) TheTitle

    Query:
    "Book" ext:chm chm

    Query:
    "OReilly" ext:chm chm

    Query:
    "ebook" inurl:ftp intext:chm

    Query:
    index of /pub/* intext:chm

    Query:
    ?intitle:index.of? ebook (or ebooks, try with different words like mp3, etc...)

    Query:
    inurl:OReilly filetype:chm (or pdf or html or zip or rar, etc...)


    Now, this are just examples, read the google tutorials and try to build your own querys and share them here, please.


    http://www.trap17.com/index.php/how-to-fin...-com_t9057.html

    วันพุธ, มิถุนายน 22, 2548

    ふりがなをつけるサイト

    http://www.hiragana.jp
    http://kids.goo.ne.jp

    วันศุกร์, มิถุนายน 17, 2548

    สิ่งที่จะทำต่อไปสำหรับโปรแกรม Inventorer

    สร้าง List ของ Terms ของ Category กับ Aspect ทำเป็น list box เอาไว้ให้เลือกได้.
    แล้วก็จัดการเกี่ยวกับการ check isbn ก่อน add และแจ้งเตือน เมื่อมีการ add ซ้ำ
    จะได้ดูได้จากไฟล์จริงว่าไฟล์เก่าหรือใหม่มีเนื้อหาที่เหมาะสมกับการเก็บไว้ใน
    ไลบรารี่มากกว่ากัน (และ จัดการเกี่ยวกับ Interface ให้สวยงามขึ้น)

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

    Eclipse LaTex Plugins

    ลองคุ้ยๆ ใน google ดูว่ามี ลาเท็ช plugin ตัวไหนบนอีขลิบบ้างที่น่าใช้ๆ
    • TeXlipse น่าใช้
    • eTeX a.k.a. ecleTex
    • LatEc ดูไม่ค่อยเวิร์คเท่าไหร่

    เจอ TeXlipse ค่อนข้างใหม่ แต่สมบูรณ์ คิดว่าน่าใช้ดี แต่ ดูจาก activity ใน sourceforge แล้วยังต่ำอยู่ อาจจะเป็นเพราะว่ายังใหม่ก็ได้ พึ่งลงทะเบียนกับทาง sourceforge เมื่อเดือนมีนาคมที่ผ่านมา

    *DocJar เป็น plugin อีกตัวที่น่าใช้ (เอาไว้ใช้หา open source Java jar file ที่มีอยู่ในเนต)

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

    บทวิเคราะห์ การทำงานของ Amazon Web Service หรือ ECS (e-commerce service)

    วันนี้มาผ่าตัดเจาะลึกเกี่ยวกับ Amazon Web Service กันหน่อย.
    ทำเอาไม่ได้หลับได้นอนมาหลายวัน เล่นก้ับ SOAP แบบ schemas 3
    แล้วมันไม่เวิร์ค(ใช้ tools ของ sun มา gen พวก stub classes) ต้องใช้
    schemas2.

    หลังจากดิ้นรนจนทำให้ไม่ได้หลับได้นอนไปกับการเรียนรู้ไอ่บัด SOAP ก็ระลึกได้ว่า
    เฮ้ย! REST แม่งน่าจะเวิร์คกว่าว่ะ (คิดเรื่อง flexibility portability) เพราะมันเรียกผ่าน
    เว็บแล้วก็ http ไม่ได้อาศัยพวก RPC จึงน่าจะโปร่งใส ปลอดภัย จากเรื่องความแตกต่าง
    ทางสถาปัตยกรรมของระบบ.

    วันนี้ก็เลยหันกลับมาหา REST เริ่มต้นด้วยการผ่าตัดโปรแกรมตัวอย่างที่หาโหลดได้จาก
    เว็บของ Amazon. ไม่พูดพล่ามทำเพลงแล้ว เริ่มเลย


    1. เซต layout
    getContentPane().setLayout( new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));

    2. สร้าง tabbed pane แล้วก็ add
    JTabbedPane tabbedPane = new JTabbedPane();
    getContentPane().add(tabbedPane);


    3. สร้าง container ใหม่ เพื่อบรรจุลงใน tab ของ REST แล้วก็ add
    this.xmlPane = new Container();
    this.xmlPane.setLayout(new BoxLayout(this.xmlPane, BoxLayout.Y_AXIS));
    tabbedPane.addTab("REST", null, this.xmlPane, "Send XML Requests");


    วันพุธ, มิถุนายน 08, 2548

    Tweak Windows XP สำหรับเครื่องที่มี RAM เหลือกินเหลือใช้

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management

    Disable Paging Executive:
    XP pages data from RAM memory to the hard drive. We can stop this happening and keep more data in RAM, resulting in better performance. Users with a large amount of RAM (256MB+) should use this setting. The setting we change to disable the ’Paging Executive’, is DisablePagingExecutive. Changing the value of this key from 0 to 1 will de-activate memory paging.

    System Cache Boost:
    Changing the value of the key LargeSystemCache from 0 to 1 will tell XP to allocate all but 4MB of system memory to the file system cache, allowing the XP Kernel to run in memory. The 4MB of memory left is used for disk caching, if more is needed, XP allocates more. Generally, this tweak improves performance by a fair bit but can, in some intensive applications, degrade performance. As with the previous tweak, you should have at least 256MB of RAM before attempting to enable LargeSystemCache.
    Input/Output Performance:
    This improves performance of large file transfers. If this entry does not appear in the registry, you will have to create a REG_DWORD value called IoPageLockLimit. The data for this value is in number of bytes, and defaults to Zero which equates to 512KB on machines that have the value. Most people using this tweak have found maximum performance in the 8 to 16 megabyte range, so you will have to play around with the value to find the best performance. The value is measured in bytes, so if you want, 12MB allocated, it’s 12 * 1024 * 1024, or 12582912. As with all these memory tweaks, you should only use this if you have 256MB or more of RAM.

    วันพุธ, มิถุนายน 01, 2548

    Transform DOM XML document ไปเป็น file ด้วย

    javax.xml.transform.dom
    javax.xml.transform.sax
    javax.xml.transform.stream


    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;

          TransformerFactory xformFactory
    = TransformerFactory.newInstance();
    Transformer idTransform = xformFactory.newTransformer();
    Source input = new DOMSource(doc);
    Result output = new StreamResult(System.out);
    idTransform.transform(input, output);

    Java : ใช้ static block ในการ initialize ค่าเริ่มต้นให้กับตัวแปลที่เป็น static

    ปกติจะนิยมให้ Constructor initialize ค่าเริ่มต้นให้กับตัวแปรต่างๆ
    แต่กรณีของคลาสที่มีความเป็น static สูง ต้องใช้ static block ในการ
    initialize แทน เนื่องจากว่า Constructor อาจจะยังไม่เคยถูกเรียกเลยแต่ก็ดันไป
    เรียกใช้ static method ของคลาสที่มีความเป็น static สูงนั้นแล้ว.

    static {
    initialize something here;
    }

    วันจันทร์, พฤษภาคม 30, 2548

    ใช้อันไหนดี ArrayList, LinkedList หรือ Vector

    โดยทั่วๆไป ArrayList น่าจำเป็นคำตอบที่ดี(เร็ว) ในหลายๆ กรณี.
    หากต้องการ Synchronized List ก็ให้ใช้ Vector.
    รายละเอียดเพิ่มเติม ที่ Performance of Java Collections that implements the List - Interface

    วันอาทิตย์, พฤษภาคม 29, 2548

    เกี่ยวกับJava : การประกาศ Class และ สมาชิกของ Class

    อยากเขียนโปรแกรมให้สวยๆ ก็เลยต้องศึกษา, วางแผน ให้รอบคอบก่อนแล้วค่อยลงมือ. เกิดสะดุดใจอยู่เรื่อง modifier เวลาประกาศ class ของ Java ว่ากันสั้นๆ สรุปเป็นตารางก่อนตามนี้ :
    Class Declaration Elements
    Element Function
    public (Optional) Class is publicly accessible.
    ส่วนขยาย public บอกว่าคลาสนี้สามารถเรียกใช้ได้จาก
    คลาสอื่นๆ อย่างสาธารณะ (ต่างแพคเกจก็เรียกใช้ได้). ถ้าไม่ประกาศ public คลาสนี้ จะสามารถเรียกใช้ได ้จากคลาสอื่นในแพรเกจเดียวกันเท่านั้น.
    ดูเพิ่มเติมที่ Creating and Using Packages  (in the Learning the Java Language trail)
    abstract (Optional) Class cannot be instantiated
    ส่วนขยาย abstract บอกว่าคลาสนี้ไม่สามารถนำไปสร้าง instance ได้. เพราะมันเป็นคลาสนามธรรม.
    ดูเพิ่มเติมที่ Writing Abstract Classes and Methods (in the Learning the Java Language trail)
    final (Optional) Class cannot be subclassed
    สำหรับเหตุผลว่าทำไมถึงอยากให้มี final class ดูเพิ่มเติมที่
    Writing Final Classes and Methods (in the Learning the Java Language trail)
    class NameOfClass ชื่อคลาส
    extends Super (Optional) Superclass of the class
    ส่วนขยาย extends ระบุ superclass ของ class ที่ประกาศ.
    คลาสที่ประกาศก็จะถูกบรรจุอยู่ในลำดับชั้นของการสืบทอดคลาส.
    ดูเพิ่มเติมที่ Managing Inheritance (in the Learning the Java Language trail)
    implements Interfaces (Optional) Interfaces implemented by the class
    ใช้คีย์เวิร์ด implements ตามด้วยรายการชื่ของ interface ที่จะอิมพลีเมนต์ (ขั้นแต่ละชื่อด้วยคอมม่า). หลักการสร้างและการใช้ interface ดูเพิ่มเติมที่ Creating and Using Interfaces (in the Learning the Java Language trail).
    {
    ClassBody
    }
    Provides the class's functionality

    การควบคุมการแอคเซส สมาชิกของคลาส

    ในทำนองเดียวกับเรื่องการประกาศคลาสข้างบน การประกาศสมาชิกของคลาส กำหนดการเข้าใช้สมาชิกของคลาสนั้น จากข้างนอก สรุปเป็นตารางสั้นๆ ดังนี้:
    Access Levels
    Specifier Class Package Subclass World
    private Y N N N
    no specifier Y Y N N
    protected Y Y Y N
    public Y Y Y Y
    ข้อควรระวัง access level เป็นตัวกำหนดว่า คลาสไหน สามารถแอคเซสสมาชิกที่ ถูกโมดิฟาย นั้นได้. มิใช่ว่า อินสแตนซ์ไหน สามารถแอคเซสได้.

    ตัวอย่าง
    package One;
    public class Alpha {
    private int iamprivate = 1;
    private void privateMethod() {
    System.out.println("iamprivate Method");
    }
    ...
    public boolean isEqualTo(Alpha anotherAlpha) {
    if (this.iamprivate == anotherAlpha.iamprivate) {
    //legal
    return true;
    } else {
    return false;
    }
    }
    }
    คลาส Alpha ข้างบนนั้น สามารถ อ้างถึง private member ของอินสแตนซ์ อื่นได้ เพราะมันเป็นอินสแตนซ์ของคลาสเดียวกัน. คราวนี้พิจารณาคลาส DeltaAlpha
    package One;
    public class DeltaOne {
    public static void main(String[] args) }
    Alpha a = new Alpha();
    //a.privateMethod(); //illegal
    a.packageMethod(); //legal
    a.protectedMethod(); //legal
    a.publicMethod(); //legal
    //System.out.println("iamprivate: "
    // + a.iamprivate); //illegal
    System.out.println("iampackage: "
    + a.iampackage); //legal
    System.out.println("iamprotected: "
    + a.iamprotected); //legal
    System.out.println("iampublic: "
    + a.iampublic); //legal
    }
    }
    จะเห็นได้ว่า private member และ private method นั้น เราไม่สามารถแอคเซสได้ จากคลาสอื่นที่ไม่ใช่คลาส Alpha แต่เราสามารถแอคเซส protected member และ protected method ได้จาก DeltaAlpha เพราะว่ามันอยู่ในแพคเกจเดียวกัน

    รายละเอียดเพิ่มเติมดูจาก การควบคุมการแอคเซสสมาชิกของคลาส สำหรับการใช้และสร้างแพคเกจ --> Creating and Using Packages (in the Learning the Java Language trail).

    วันจันทร์, พฤษภาคม 23, 2548

    ปัญหา Mac OS X แชร์ไฟล์กับ Windows2000 Server และ TLS/SSL ftp

    มีปัญหาเรื่องจะแชร์เพลงใน Music Server มาฟังที่เครื่องแมค อยู่นาน
    พึ่งมาเจอว่าที่ Server มันไม่ได้ enable NETBIOS over TCP/IP ไว้
    เลย enable อันที่เป็น interface ที่ 2 แล้วก็แอคเซสได้ด้วย mount_smbfs
    ------------
    หาซอฟต์แวร์ที่ทำ ftp แบบรองรับ TLS/SSL ได้. หาอยู่ตั้งนานเออ...
    ส่วนมากมีแต่แชร์แวร์ ขัดกับอุดมการณ์ ก็เลย เอาวะ ลง fink ซะเลย
    พอดีมันมี ftp-tls เป็น patch ของ ftp ของ OpenBSD ซึ่งทำให้รองรับ
    ก็เลยลองเล่นดู. command-line เนี่ยแหละเก๋า.
    แต่เวลาจะเรียกใช้กับโฮสภาคต้องให้มันใช้ TLS กับ data channel ด้วย
    ต้องเรียกด้วย $ ftp -z private

    วันพฤหัสบดี, พฤษภาคม 19, 2548

    Eject CD tray in Mac OS X by F12 key.

    ใช้ SpaceSaver II Keyboard ของ IBM เลยไม่มีปุ่ม eject CD ให้กดใน Mac OS X.
    เวลาจะเอา ซีดี ออกทีก็ต้องถ่อเปิด iTunes ขึ้นมาแล้วกด Winkey + E เอา.
    โง่อยู่นาน... วันนี้ลอง google หาดูเออ กด F12 ก็ได้เหมือนกันนี่หว่า
    แต่ว่าต้องกดค้างสัก 2 วินาทีนะ ไม่งั้นไม่เวิร์ค. โอ้ เยี่ยม จดไว้กันลืม.

    วันจันทร์, พฤษภาคม 09, 2548

    ็็H8 interrupt ทำอย่างไร?

    วันนี้อยากจะลองใช้ interrupt กับ H8 ดู เลยลองคุ้ยๆดูใน google
    ก็ไปเจอ เมล์ลิ่งลิสต์ นี้เข้า
    คิดว่าน่าจะใช้ได้ทีเดียว
    http://www.toppers.jp/TOPPERS-USERS/200501/msg00019.html

    แ่ต่มันค่อนข้างยุ่่งยาก เอาวะ ไว้วันหลัง
    อันนี้ก็เป็นอีก ไซต์นึงที่เขียนเกี่ยวกับ interrupt ไว้นิดหน่อย
    http://robotics.toyama-nct.ac.jp/H8/toppers/

    วันนี้เหนื่อยแล้ว พอแค่นี้ก่อนเว๊ย

    วันพุธ, เมษายน 20, 2548

    Today's Vocab.

    drows·y Pronunciation Key (drouz) แย่ลงเพราะความง่วง
    adj. drows·i·er, drows·i·est

    1. Dull with sleepiness; sluggish.
    2. Produced or characterized by sleepiness.
    3. Inducing sleepiness; soporific.
    ----------
    prose Pronunciation Key (prz) บทความ,ประโยค(การเขียนอย่างไม่ค่อยเป็นทางการ)
    n.

    1. Ordinary speech or writing, without metrical structure.
    2. Commonplace expression or quality.
    3. Roman Catholic Church. A hymn of irregular meter sung before the Gospel.

    intr.v. prosed, pros·ing, pros·es

    1. To write prose.
    2. To speak or write in a dull, tiresome style.
    ----------
    pro·cras·ti·nate (pr-krst-nt, pr-)
    v. pro·cras·ti·nat·ed, pro·cras·ti·nat·ing, pro·cras·ti·nates
    v. intr.

    To put off doing something, especially out of habitual carelessness or laziness.


    v. tr.

    To postpone or delay needlessly.

    วันศุกร์, เมษายน 15, 2548

    const Pointer

    -POINTER TO A CONSTANT-
    const char *thing_ptr = "Seven";

    THEN

    thing_ptr = "Forty" /* Legal */
    *thing_ptr = 'X' /* Illegal */

    BECAUSE
    What's thing_ptr? A pointer.
    Can it be changed? Of course, it's just a pointer.
    What does it point to? A const char array.
    Can the data pointed to by thing_ptr be changed? No, it's a constant.

    -CONSTANT POINTER-
    char *const name_ptr = "Test"

    name_ptr = "New"; /* Illegal */
    *name_ptr = 'Q'; /* Legal */

    What's name_ptr? It's a constant pointer.
    Can it be changed? No, it's a constant.
    What does it point to? A char.
    Can the data being pointed by name_ptr be changed? Yes.

    Finally, we can put const in both places.

    const char *const title_ptr = "Title".

    is a pointer that can't be changed and it points to a data item that can't be changed also.

    Applying a command through all files in a directory recursively.

    คำสั่งข้างล่างนี้ใช้ แปลงรหัสอักขระจาก EUC-jp ไปเป็น jis-2022-jp สำหรับทุกไฟล์ที่มีนามสกุล .html

    % find ./html/ | grep "\.html" | awk '{print "nkf -j -E "$1" > "$1""}' | sh

    * An equivalent result can be achieved by using xargs. man xargs for more detail.

    วันอังคาร, เมษายน 12, 2548

    Creating Developing Environment for H8

    1. ดาวน์โหลดไฟล์ต่างๆตามนี้
    * binutils-2.11.2
    * gcc-2.95.3
    * newlib-1.9.0
    * gdb-5.2.1
    * make
    * perl

    $ mkdir ~/toppers_env && cd toppers_env
    $ mkdir ~/build && cd build

    2. Compile and Install binutil
    $ tar zxvf binutils-2.11.2.tar.gz && binutils-2.11.2
    $ mkdir work && cd work
    $ ../configure --target=h8300-hms --disable-nls --prefix=/opt/toppers_jsp
    $ make
    $ make install
    $ ~/toppers_env/bin/h3800-hms-as -v

    3. Compile and Install gcc
    $ tar zxvf GCC.tar.gz && cd GCC
    $ patch -p1 < ../gcc-2.95.3_01.patch
    $ mkdir work && cd work

    $ ../configure --target=h8300-hms --disable-nls --prefix=/opt/toppers_jsp \ --with-gnu-as --with-gnu-ld --with-newlib --enable-languages=c,c++ \ --with-headers=../../newlib-1.9.0/newlib/libc/include

    $ make

    $ make install

    วันศุกร์, เมษายน 08, 2548

    Input ภาษาญี่ปุ่น โดย Anthy & UIM

    ดูจากเว็บนี้เลย
    http://www.engr.colostate.edu/~reinholz/freebsd/japanese.htm

    วันพฤหัสบดี, เมษายน 07, 2548

    Mac OS X แชร์ไฟล์กับ Windows โดย SMB

    1. smbclient
    smbclient //150.65.???.???/sharename -W domainname -U username

    Fonts Thai ทำอย่างไรให้ไม่อุบาทว์ ใน X11 FreeBSD 5.3

    ติดตั้งฟอนต์ไทยลงไปลองหลายวิธี แรกๆ ดูจากเว็บ อ.ชัชวาล แต่ว่ามันน่าเกลี๊ยด น่าเกลียด
    เลยเอาใหม่วะ ลองดู เคยทำได้นี่หว่า
    ผลลัพธ์ ออกมา โอเคเว๊ย ไม่เลว

    สรุปวิธีการดังนี้

    1. ก๊อปปี้ TrueType ฟอนต์ จาก Windows มา ที่ /usr/X11R6/lib/X11/fonts/jojoTrueType
    *หมายเหตุ ลองดูพวก user/group และก็ permission ให้ดีๆ ด้วยว่ามันโอมั้ย!

    2. สร้างไฟล์ scalable fonts "fonts.scale" ใช้คำสั่ง
    # ttmkfdir > fonts.scale

    3. สร้างไฟล์ encoding.dir และ fonts.dir ใช้คำสั่ง
    # mkfontdir -e /usr/X11R6/lib/X11/fonts/encodings

    4. เพิ่ม FontPath ลงไป ใน /etc/X11/xorg.conf
    FontPath "/usr/share/fonts/TIS-620/TrueType"

    5. ดูให้แน่ๆว่าตรง Module มี Load "freetype" โหลดอยู่อ๊ะป่าว?

    6. startx จบ

    VMware 4.5.2 กับ FreeBSD 5.3

    วันนี้ลองลง VMware 4.5.2 ในเครื่อง Let's Note ดู เพราะว่า เคยลงแบบ
    Physical แล้วมันไม่เวิร์ค วันนี้ลองลงแบบ Virtual ว่าเป็นไง
    >>> ผล ก็โอเลยทีเดียว

    แต่ที่ติดปัญหานิดหน่อยคือตอนลง VMware Tools แล้ว Vmware Tools มันอนุมาน
    เอาว่าเราใช้ XFree86 ซึ่งจริงๆ แล้วใน FreeBSD 5.3 มันเป็น X.org ไปแล้ว.
    ดังนั้นจึงต้องมีการแก้ สคริปต์ของ VMware Tools สักเล็กน้อย

    ขั้นตอนการแก้ไข
    1. ถ้าลง VMware Tools ไปก่อนแล้วก็ต้อง uninstall กันก่อน
    # /usr/local/bin/vmware-uninstall-tools.pl

    2. เข้าไปแก้สคริปต์ของ VMware Tools ที่เราแตกไว้แล้ว สมมติว่าอยู่ที่ /tmp
    # cd /tmp/vmware-tools-distrib

    ณ บรรทัดที่ 2852
    แก้จาก return xserver_bin (). ' /XFree86'
    เป็น return xserver_bin (). ' /Xorg'

    ณบรรทัดที่ 3055
    แก้จาก /X.org Foundation/? ' 4.4.0' ' 0.0.0'
    ไปเป็น /Release 6.7/? ' 4.3.0' ' 0.0.0'

    แล้วก็เพิ่มบรรทัดสองบรรทัดข้างล้างนี้ ลงไปหลังจากบรรทัดที่ 3065
    } elsif (file_name_exist ($xconfig_path. ' /xorg.conf')) {
    $xconfig_file_name = ' xorg.conf' ;

    3. ลง VMware Tools ด้วย สคริปต์ใหม่ที่ผ่านการแก้ไขเรียบร้อยแล้ว

    4. แก้ /etc/X11/xorg.conf เป็นดังนี้