| JA | TH |
|---|---|
| 文法 | ไวยากรณ์ |
| 文 | ประโยค |
| 句 | วลี |
| 節 | อนุประโยค |
| 単語 | คำศัพท์ |
| 修飾(しゅうしょく) | การขยายคำ (modify) |
| 名詞 | คำนาม |
| 動詞 | คำกริยา |
| 助詞 | คำบุพบท |
| 副詞 | คำวิเศษณ์ |
| 接続詞 | คำสันธาน |
| 数詞 | คำบอกจำนวน |
| 助数詞 | คำลักษณะนาม |
| 疑問詞 | คำแสดงคำถาม |
| 主語 | ประธาน(หัวเรื่อง) |
| 述語 | ส่วนขยาย |
| 目的語 | กรรม |
| 主題 | หัวข้อเรื่องหลัก |
| 肯定(こうてい) | บอกเล่า |
| 否定 | ปฏิเสธ |
| 完了 | สมบูรณ์ |
| 未完了 | ไม่สมบูรณ์ |
| 過去 | อดีต |
| 非過去 | ไม่อดีต |
วันพฤหัสบดี, มีนาคม 30, 2549
คำศัพท์ที่ใช้ในไวยากรณ์ภาษาญี่ปุ่น (Words used in Japanese Grammar)
วันพุธ, มีนาคม 22, 2549
LaTeX package for typesetting books, reports
It can potentially help in typesetting a book.
I'm to check it later.
วันศุกร์, มีนาคม 10, 2549
Upgrade MediaWiki to 1.57 and Apache 2
ถือโอกาส อัพเกรดไปพร้อมๆกันเลย
รายละเอียดเริ่มอ้างอิงจากที่นี่
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
# 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- secure the default accounts หลังจากติดตั้ง MySQL เสร็จใหม่ๆ installer ของ Mac มันจะ initialize database ให้อยู่แล้ว (mysql_install_db) แต่ grant tables ที่มัน init มาให้จะไม่มี password ดังนั้นเราต้องเซต password ด้วยเพื่อความปลอดภัย
`/Library/StartupItems/MySQL)
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
- copy database ที่ dump ออกมาจากตัวเก่าไปยัง version ใหม่
ปล. มี CocoaMySQL ที่เคยลงไว้ มันเป็น client เอาไว้ connect ไปจัดการกับ MySQL server แต่ CocoaMySQL ใช้กับ version 4.0.21 ได้ แต่ไม่สามารถใช้กับ version 5 ได้เพราะว่า password
encryption มันต่างกัน ต้องไปใช้ CocoaMySQL version beta0.7 ถึงเวิร์ค
(อ้างอิง: 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 -pdb_name
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:
- Open your preferred text editor and create a plain text file.
- Type this text (on two lines as shown):
[mysqld]
socket=/tmp/mysql.sock - Save the file as: /etc/my.cnf
To change the location where PHP looks for the socket file, follow these steps:
- In Terminal: sudo cp /etc/php.ini.default /etc/php.ini
- Open /etc/php.ini in your preferred text editor.
- 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
- 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
ทีนี้เราสามารถ 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 ได้