วันพฤหัสบดี, กรกฎาคม 27, 2549
วันอังคาร, กรกฎาคม 04, 2549
เกี่ยวกับ real-time java
- Sun Java RTS
- TimeSys RTSJ Reference Implementation
- Aonix PERC
- ของSunเค้าปล่อยให้เฉพาะOEM
- ส่วนของTimeSysนี่ให้ดาวน์โหลดฟรีแต่รองรับ J2ME spec สามารถรันบน Linux ได้แต่เนื่องจากเคอร์เนลมาตรฐานของ Linux มันรับได้ไม่ถึง 255? PRIORITIES และไม่สามารถรองรับ priority inheritance ของ RTSJ เพื่อป้องกัน priority inversion problem มันจึงต้องการ Real-time Kernel หรือ Extension ของ TimeSys เป็น TimeSys Linux/RT ตัวนี้ขาย แต่ตัวที่เป็น TimeSys Linux/GPL ก็มี แต่ว่าไม่รองรับ priority inheritance.
- ของ Aonix ยังไม่ได้ดูรายละเอียด ไว้ดูมาเมื่อไหร่ค่อยมาบันทึกเพิ่ม
วันเสาร์, กรกฎาคม 01, 2549
mount smbfs with write permission for normal user
วันพุธ, มิถุนายน 14, 2549
Backup DSpace
เนื่องจากเราจะให้การแบ็คอัพทำเป็น cron job ดังนั้นการดั๊มเดต้าเบสนั้นต้องมีการบอกรหัสผ่านไว้ล่วงหน้า เราทำโดยสร้างไฟล์ .pgpass มาที่โฮมไดเรคทอรี่ของยูเซอร์ โดยให้ในไฟล์มีฟอร์แมตตามนี้
hostname:port:database:username:passwordใช้ \ เป็น escape character กรณีที่ต้องใช้ : หรือ \ ในแต่ละ entry
เท่านี้มันก็จะไม่ถาม password แล้ว
คำสั่งที่ใช้คือ:
$ /usr/local/pgsql/bin/pg_dump -U dspace -o -c -v dspace > $SOMEWHERE/dspacedb_backup.pgsql
วันอังคาร, มิถุนายน 06, 2549
sed delete all lines containing a specific word
$ sed '/[Tt]est/d'
$ sed '/.\/Education\//d'
อีกมากมายหาดูได้จาก Unix Shell Programming.
วันจันทร์, พฤษภาคม 29, 2549
Upgrade PHP from 4.4.1 to 5.1.4
PHP Version 4.4.1
| Configure Command | '/SourceCache/apache_mod_php/apache_mod_php-18.4/php/configure' '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--with-apxs' '--with-ldap=/usr' '--with-kerberos=/usr' '--enable-cli' '--with-zlib-dir=/usr' '--enable-trans-sid' '--with-xml' '--enable-exif' '--enable-ftp' '--enable-mbstring' '--enable-mbregex' '--enable-dbx' '--enable-sockets' '--with-iodbc=/usr' '--with-curl=/usr' '--with-config-file-path=/etc' '--sysconfdir=/private/etc' '--with-mysql=/usr' '--with-mysql-sock=/var/mysql/mysql.sock' |
| Server API | Apache |
| Virtual Directory Support | disabled |
| Configuration File (php.ini) Path | /private/etc/php.ini |
| PHP API | 20020918 |
| PHP Extension | 20020429 |
| Zend Extension | 20050606 |
| Debug Build | no |
| Zend Memory Manager | enabled |
| Thread Safety | disabled |
| Registered PHP Streams | php, http, ftp, compress.zlib |
ขี้เกียจคอมไพล์เอง เลยอัพเดทแบบไบนารี่ เอามาจากเว๊บนี้ http://www.entropy.ch/software/macosx/php/#update
โหลดอันของ Apache 1.3 มาเพราะไม่อยากอัพเกรด Apache ไปเป็น ๒ ไม่งั้นคงลำบากน่าดู.
php5 ถูกติดตั้งลงไปที่ /usr/local/php5.
หลังจากติดตั้งแล้วสตาร์ทอะปาชี่ไม่ติดเพราะเหมือนกับว่า php4 และ php5 มันถูกโหลดทั้งคู่เลยตีกัน.
(php5 ถูกโหลดโดย /etc/httpd/users/+entropy-php.conf ซึ่งเป็น symbolic link ไปที่ /usr/local/php5/entropy-php.conf
ลองลบส่วนที่เป็นของ php4 ออก
แล้วอาศัยการ include โดยแยกส่วนที่ include php4 กับส่วนของ php5 ออกจากกันแล้วใช้การรีเนมเอา
Include /private/etc/httpd/users/*.conf
/private/etc/httpd/users/+php4.conf กับ +php5.conf
วันอาทิตย์, พฤษภาคม 28, 2549
DSpace : Export items in a collection.
$
######################################################
# This document was kindly contributed by Larry
# Lansing (lansil @ fuzzynerd.com). For any questions
# regarding this information, please contact him
# directly.
######################################################
As promised, here are my loadbalancing configuration files. These are
still works-in-progress--there are probably mistakes and omissions. I
hope someone finds these useful.
Notes: The apache server (I'll call it "www") relays connections to
two tomcat servers called "jsp1" and "jsp2", using ajp13. www runs
Apache2.0, with mod_jk. jsp1 and jsp2 run Tomcat 4.1.24. I have
tried to simplify my configs by disabling unnecessary tomcat
connectors, such as the standalone port 8080 HTTP connector.
www configs
-----------
httpd.conf must include these lines in appropriate places:
***
LoadModule jk_module libexec/apache2/mod_jk.so
Include /usr/local/etc/apache2/mod_jk.conf
***
mod_jk.conf:
***
JkWorkersFile /usr/local/etc/apache2/workers.properties
JkLogFile logs/jk.log
JkLogLevel warn
JkMount /dspace/* loadbalancer
JkMount /dspace-oai/* loadbalancer
***
workers_properties:
***
worker.list=loadbalancer
worker.jsp1.port=8009
worker.jsp1.host=jsp1
worker.jsp1.type=ajp13
worker.jsp1.lbfactor=1
worker.jsp2.port=8009
worker.jsp2.host=jsp2
worker.jsp2.type=ajp13
worker.jsp2.lbfactor=1
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=jsp1, jsp2
***
jsp1 and jsp2
-------------
Tomcat's server.xml (still a bit "raw" until I figure out what each
option does):
***
acceptCount="10" debug="0"/>
timestamp="true"/>
pattern="common"/>
timestamp="true"/>
***
วันเสาร์, พฤษภาคม 27, 2549
jLibrary
หลังจากลง tomcat ใหม่เป็น 5.5 แล้วก็ลองใส่ jLibrary ดู ทำตามนี้ตรงๆ :
To install the jLibrary WAR application you should follow the next steps:
- Go to the jLibrary downloads section on sourceforge.net and download the .WAR distribution bundle. If you want to create an up-to-date distribution, checkout the build guide on the developers section to find how to build jLibrary sources from CVS.
- Once you have downloaded the bundle, you'll find a zip file with the web application archive. Also there is some documentation in the form of a README.txt file, and a jaas.config file. Now, you can place the jlibrary.war file on your webapps directory.
- The next step is to add the jaas.config file to your Apache Tomcat conf directory. If you already have a jaas.config file, then you can add to it the following lines:
Jackrabbit {
org.apache.jackrabbit.core.security.SimpleLoginModule required anonymousId="anonymous";
}; - And finally you must tell to tomcat where is the jaas.config file if you haven't done yet. This can
be done in several ways from your catalina file. For example adding the following line to the
java command, or to the CATALINA_OPTS environment variable:-Djava.security.auth.login.config=%CATALINA_HOME%/conf/jaas.config
Configure different storage locations.
On the jLibrary configuration file there are several locations in which you will have to define paths to directories in which content will be stored. For example, the he first section of the jLibrary configuration allows you to change the location on the file system where the jLibrary repositories system data will be created. You can see it here:
As you can see, this section (and many others on the configuration file) is using a special variable ${rep.home}. The real location on the file system for this variable depends on the applaction server in which you are running jLibrary. For example, on Apache Tomcat it will be the bin directory. Proabably you really won't like to store contents on that place. If this is the case, you can replace all the occurrences of the ${rep.home} with any other custom location. Even more, you can use different locations for different things. This is a sample with the location changed:
These are all the places in which the ${rep.home} variable appears and that you can easily replace by other locations:
- Base repository structure location (seen on the example)
- Workspaces location. This will correspod with each jLibrary repositry.
- Versions location. The place in which version history file data will be stored.
- System index. The place in which the search information for version history will be stored.
วันพุธ, พฤษภาคม 24, 2549
find และ xargs
เพราะว่า find -exec มัน fork เยอะ
(อ้างอิง)
http://www.sunmanagers.org/pipermail/summaries/2005-March/006255.html
Thanks very much for the quick responses - herewith a summary of what I learned:
The problem is not one of recursion limit, but one of (in)efficiency.
It is much more efficient to use find | xargs than find -exec {} \;
"find ... -exec command {} \;" runs the command once for each name.
If find identifies 10000 files, using -exec grep ... as an example,
find would fork off a child copy of itself, the copy would become a
grep working on a single file. Meanwhile the original parent find
would sleep waiting for its child (grep) to finish before searching
for the next file that meets the find criteria. That means 10000
executions of grep and pauses of find.
"xargs command" reads names on its standard input, and feeds them in
bunches to command, so that command is run fewer times (only once, in
most cases). So, if we use find | xargs grep ..., the find is able to
work "non-stop" filling the pipe with found file names. xargs
collects groups of about 20 - 50 names and does a single grep for the
collection. Find doesn't pause and you only do about 200 greps, not
10000. There isn't a forked process for every single file.
The weaknesses of xargs are (1) it can be confused by "funny"
filenames (which is why Gnu has find -print0 |xargs -0, or you can
pipe through sed to add backslashes everywhere), and (2) it can feed
zero arguments to command which might then
just sit there waiting (this is why Gnu xargs has -r which means:
don't run command if stdin is empty).
These days, you can use "find ... -exec command {} +" which groups
arguments together. However, I found that this did not give
satisfactory grep results when invoked as:
find /usr/include -type f -exec grep NFS_VERSION {} \+ -print (or
without the escaped +)
The following examples show the time difference (and slightly more
useful output of xargs):
$ time find /usr/include -type f -exec grep NFS_VERSION {} \; -print
#define NFS_VERSION ((rpcvers_t)2)
/usr/include/nfs/nfs.h
#define NFS_VERSION 2
/usr/include/rpcsvc/nfs_prot.h
version NFS_VERSION {
/usr/include/rpcsvc/nfs_prot.x
real 0m9.883s
user 0m3.340s
sys 0m5.900s
$ time find /usr/include -type f|xargs grep NFS_VERSION
/usr/include/nfs/nfs.h:#define NFS_VERSION ((rpcvers_t)2)
/usr/include/rpcsvc/nfs_prot.h:#define NFS_VERSION 2
/usr/include/rpcsvc/nfs_prot.x: version NFS_VERSION {
real 0m0.677s
user 0m0.380s
sys 0m0.310s
Thanks,
Steve Nelson ตัวอย่างการใช้ เช่น เราจะหา md5 checksum ของไฟล์หลายๆไฟล์แบบเวียนเกิด recursively ก็ใช้คำสั่ง
$ find . -type f \! -name "._*" -print0 | xargs -0 md5sum
เอาเฉพาะ regular file
อันที่ไม่ได้ขึ้นต้นด้วย ._ ใน Mac OS มันชอบมีไฟล์ที่ขึ้นต้นด้วย ._ เยอะ
print ออกมาโดยใส่ null (\0) แทน whitespace ธรรมดา เพราะ xargs มันไม่ค่อยฉลาดตรงนี้
t I jojo$ time find . \! -name ".*" -print0 | xargs -0 md5sum
17c6d0eb1e725ef16e78bfd8c99219c7 ./01 ใคร.m4a
a0bbe221525288210e0a1cdb4f03eb95 ./02 ผมแอบชอบคุณอยู่.m4a
df68e7fc0984fa7dbe1172d476300c2b ./03 คนข้างล่าง.m4a
ccf9def29b9027d62f597c6e31e07066 ./04 Live & Learn.m4a
a1be585bd5e1b304aec8905a1959621c ./05 นานแค่ไหน.m4a
9759b2c841786f07d70260975932a4d7 ./06 ล้มบ้างก็ได้.m4a
214db53c2c2f519f59cc3b24fd6eb360 ./07 เหมือนเคย.m4a
3945193b6ecb2497cf04acb5f26d5ea3 ./08 พอ.m4a
7d2d16c919de20d1e3d174699f0aa821 ./09 หัวใจผูกกัน.m4a
babba2eb62de6f080280ec896016fe5c ./10 Who,What,When,Where,Why.m4a
55f6de761c829ea1adc227f14ad181f6 ./11 ต่างมุม.m4a
afe989790d19fd36b8f8c28fa8e555c4 ./12 เพลงรัก.m4a
real 0m56.337s
user 0m12.174s
sys 0m1.962s
วันอังคาร, พฤษภาคม 23, 2549
Samba บน Solaris และ PostgreSQL บน Mac สำหรับ DSpace
คำสั่งคอนฟิก
./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คอมไพล์ไม่ผ่าน สุดท้ายต้องใช้ package pkgadd -d samba...pkg.bz
--with-ldap=no --with-ads=no
มันจะติดตั้งไปที่ /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.
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:
# 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:
e.g. if you're using the default Tomcat config, it should read:
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.
-
Download the latest DSpace source code release and unpack it:
gunzip -c dspace-source-1.x.tar.gz | tar -xf -
-
Copy the PostgreSQL JDBC driver (
.jarfile) 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 -
Create a
dspacedatabase, owned by thedspacePostgreSQL user:createuser -U postgres -d -A -P dspace ; createdb -U postgres -O dspace -E UNICODE dspace
เราเปลี่ยนคำสั่ง createdb โดยให้ postgres ซึ่งเป็น DB admin ครีเอท เพราะไม่สามารถให้ dspace DB user create ได้โดยตรง
As the
dspaceUNIX user, compile and install DSpace:cd [dspace-source] ; ant fresh_install
ติดตั้ง handle server
- 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-configafter configuringdspace.cfg, but we did not do this. - Mail the file
/dspace/handle-server/sitebndl.ziptohdladmin@cnri.reston.va.us. They will quickly create your global identifier and email you with the appropriate information. - 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. - While still in
config.dct, update any lines that say something likeYOUR_NAMING_AUTHORITYwith 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, underserver_admins,backup_admins, andreplication_admins. - Edit
/dspace/config/dspace.cfg, changinghandle.prefixto whatever number you were assigned (in our case, the line readshandle.prefix = 1785), and changing if necessaryhandle.dirto 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
- Tab Mix Plus
- Mouse Gestures
- PDF download
- Down Them All
- Permit Cookies
- Flashblock
- Firefox Google Bookmarks
วันพฤหัสบดี, เมษายน 27, 2549
XSCF ของ PRIMEPOWER 250
แล้ว เราก็จะเห็น hostname, IP, ssh-enabled/disabled, web interface-enabled/disabled
จากนั้นก็ connect to the xscf console via ssh
วันพฤหัสบดี, มีนาคม 30, 2549
คำศัพท์ที่ใช้ในไวยากรณ์ภาษาญี่ปุ่น (Words used in Japanese Grammar)
| JA | TH |
|---|---|
| 文法 | ไวยากรณ์ |
| 文 | ประโยค |
| 句 | วลี |
| 節 | อนุประโยค |
| 単語 | คำศัพท์ |
| 修飾(しゅうしょく) | การขยายคำ (modify) |
| 名詞 | คำนาม |
| 動詞 | คำกริยา |
| 助詞 | คำบุพบท |
| 副詞 | คำวิเศษณ์ |
| 接続詞 | คำสันธาน |
| 数詞 | คำบอกจำนวน |
| 助数詞 | คำลักษณะนาม |
| 疑問詞 | คำแสดงคำถาม |
| 主語 | ประธาน(หัวเรื่อง) |
| 述語 | ส่วนขยาย |
| 目的語 | กรรม |
| 主題 | หัวข้อเรื่องหลัก |
| 肯定(こうてい) | บอกเล่า |
| 否定 | ปฏิเสธ |
| 完了 | สมบูรณ์ |
| 未完了 | ไม่สมบูรณ์ |
| 過去 | อดีต |
| 非過去 | ไม่อดีต |
วันพุธ, มีนาคม 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 ได้
วันจันทร์, กุมภาพันธ์ 27, 2549
install / uninstall codec or filter files by regsvr32 command
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
4. In the end, you should receive a message saying that your file was succesfully installed/uninstalled.
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
Mac OS X で piano を弾いてみよぉ!
- MidiKey เป็นตัวส่งออก MIDI
- SimpleSynth เป็นตัวเอาเสียงMIDIออกมา