Monday, November 3, 2008

[Xlib: connection to ":0.0" refused by server]

[Xlib: connection to ":0.0" refused by server]

If you get error messages like this ---

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified


xhost: unable to open display ":0.0"

when running a program, you probably need to add the user to the X server access list.

You can add a user to the X server access list with
# xhost +local:username


This allows "username" to connect to the local running X server.


link: http://www.captain.at/howto-xlib-connection-refused-by-server.php

Monday, October 20, 2008

How to Set JAVA_HOME / PATH variables Under Linux Bash Profile

Set JAVA_HOME / PATH for single user


Login to your account and open .bash_profile file

$ vi ~/.bash_profile

Set JAVA_HOME as follows using syntax export JAVA_HOME=<path-to-java>. If your path is set to /usr/java/jdk1.5.0_07/bin/java, set it as follows:

export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java

Set PATH as follows:

export PATH=$PATH:/usr/java/jdk1.5.0_07/bin

Save and close the file. Just logout and login back to see new changes:

$ echo $JAVA_HOME

$ echo $PATH


Tip: Use the following command to find out exact path to which java executable under UNIX / Linux:

$ which java


Please note that the file ~/.bashrc is similar, with the exception that ~/.bash_profile runs only for Bash login shells and .bashrc runs for every new Bash shell.


Set JAVA_HOME / PATH for all user


You need to setup global config in /etc/profile OR /etc/bash.bashrc file for all users:

# vi /etc/profile

Next setup PATH / JAVA_PATH variables as follows:

export PATH=$PATH:/usr/java/jdk1.5.0_07/bin

export PATH=$PATH:/usr/java/jdk1.5.0_07/bin



Save and close the file.



Link http://www.cyberciti.biz/faq/linux-unix-set-java_home-path-variable/

Thursday, October 9, 2008

Installation Instructions (Apache 2.2.xx Shared Module Version)

Download the most recent version of » Apache 2.2 and a fitting PHP version from the above mentioned places. This quick guide covers only the basics to get started with Apache 2.2 and PHP. For more information read the » Apache Documentation. The version numbers have been omitted here, to ensure the instructions are not incorrect. You will need to replace the 'NN' here with the correct values from your files.
---------------------------------------------------------------

Installation Instructions (Apache 2.2.xx Shared Module Version)
---------------------------------------------------------------

1. gzip -d httpd-2_2_NN.tar.gz
2. tar xvf httpd-2_2_NN.tar
3. gunzip php-NN.tar.gz
4. tar -xvf php-NN.tar
5. cd httpd-2_2_NN
6. ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite=shared --enable-speling=shared
7. make
8. make install

Now you have Apache 2.2.NN available under /usr/local/apache2,
configured with loadable module support and the standard MPM prefork.
To test the installation use your normal procedure for starting
the Apache server, e.g.:
/usr/local/apache2/bin/apachectl start
and stop the server to go on with the configuration for PHP:
/usr/local/apache2/bin/apachectl stop.

9. cd ../php-NN

10. Now, configure your PHP. This is where you customize your PHP
with various options, like which extensions will be enabled. Do a
./configure --help for a list of available options. In our example
we'll do a simple configure with Apache 2 and MySQL support. Your
path to apxs may differ, in fact, the binary may even be named apxs2 on
your system.

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --enable-mbstring=shared

11. make
12. make install

If you decide to change your configure options after installation,
you only need to repeat the last three steps. You only need to
restart apache for the new module to take effect. A recompile of
Apache is not needed.

Note that unless told otherwise, 'make install' will also install PEAR,
various PHP tools such as phpize, install the PHP CLI, and more.

13. Setup your php.ini

cp php.ini-dist /usr/local/lib/php.ini

You may edit your .ini file to set PHP options. If you prefer having
php.ini in another location, use --with-config-file-path=/some/path in
step 10.

If you instead choose php.ini-recommended, be certain to read the list
of changes within, as they affect how PHP behaves.

14. Edit your httpd.conf to load the PHP module. The path on the right hand
side of the LoadModule statement must point to the path of the PHP
module on your system. The make install from above may have already
added this for you, but be sure to check.

For PHP 4:

LoadModule php4_module modules/libphp4.so

For PHP 5:

LoadModule php5_module modules/libphp5.so

15. Tell Apache to parse certain extensions as PHP. For example, let's have
Apache parse .php files as PHP. Instead of only using the Apache AddType
directive, we want to avoid potentially dangerous uploads and created
files such as exploit.php.jpg from being executed as PHP. Using this
example, you could have any extension(s) parse as PHP by simply adding
them. We'll add .phtml to demonstrate.

< FilesMatch \.php$>
SetHandler application/x-httpd-php
< /FilesMatch>

Or, if we wanted to allow .php, .php2, .php3, .php4, .php5, .php6, and
.phtml files to be executed as PHP, but nothing else, we'd use this:

< FilesMatch "\.ph(p[2-6]?|tml)$">
SetHandler application/x-httpd-php
< /FilesMatch>


And to allow .phps files to be executed as PHP source files, add this:

< FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
< /FilesMatch>


16. Use your normal procedure for starting the Apache server, e.g.:

/usr/local/apache2/bin/apachectl start

- OR -

service httpd restart


---------------------------------------------------------------
Following the steps above you will have a running Apache2.2 web server with support for PHP as a SAPI module. Of course there are many more configuration options available Apache and PHP. For more information type ./configure --help in the corresponding source tree. If you wish to build a multithreaded version of Apache2.2, you must overwrite the standard MPM-Module prefork either with worker or perchild. To do so append to your configure line in step 6 above either the option --with-mpm=worker or --with-mpm=perchild. Before doing so, please beware the consequences and have at least a fair understand of what the implications. For more information, read the Apache documentation regarding

Failed dependencies: libmysqlclient.so.14 when install MySQL 5.0 on Linux

Failed dependencies:
libmysqlclient.so.14 is needed by (installed) cyrus-sasl-sql-2.1.19-5.EL4.i386
when install MySQL 5.0 on Linux

First remove old RPM s:
# rpm -i mysql
# rpm -e --nodeps mysql

then install rpm of Mysql ^_^

Thursday, September 18, 2008

10 ways to Increase Performance on a VMware System


10. Use VMware Tools




When you load the VMware tools for Windows or Linux, you get a number of benefits. First off, you can now have SVGA resolution instead of just standard VGA. This also increases graphics performance on the virtual machine. Next, the mouse between the host and guest are now synchronized. No longer do you have to press Ctrl-Alt to ext the guest operating system. Mouse performance is also increased. Finally, you can cut and paste between operating systems. These tools are easy to install. Inside the VMware management interface, once the virtual machine is booted, go to
VM -> Install VMware Tools, like this:






9. Defrag Your Virtual Disks



Just like any other operating system, over time, a disk will become fragmented. Virtual machines are no different. The time that it takes for a disk to become fragmented depends on what data is being added to and removed from the virtual machine hard drive. Periodically, you should use a program like Diskkeeper, PerfectDisk, or Windows Disk Defragmenter. You can access Window Disk Defragmenter by going to
My Computer, right-clicking on C:, click on
Properties, click on the Tools tab, and click
Defragment now.







Remember, just about any maintenance that a real computer needs, a virtual computer also needs (hey, did you put Anti-virus protection on that virtual machine?).



8. Disable Windows Visual Effects

In Windows, there are common visual effects that make it look “cooler”. However, these visual effects just cause a virtual machine to appear to run slower. This is because the visual effects take CPU/graphics resources to process. I recommend disabling these visual effects to get a slight performance increase. These visual effects settings can be found by right-clicking on in
Control Panel -> System -> Advanced Tab -> Performance Settings. Once there, click on
Adjust for best performance and click OK.







I also recommend disabling the screensaver in your virtual machine as you don’t have a real monitor that is going to get burnt in. By disabling the screensaver, you won’t have to wait for it to update when you come back to use it.



7. Run VMware in Full Screen
Mode



When you use your virtual machines, most people use them inside the VMware Management Interface window. This works fine but the performance would be better if you used that virtual machine in full screen mode. To change to full-screen mode (while you are in the virtual machine), press
Ctrl-Alt-Enter. You will notice a significant performance difference when using full-screen mode. To exit full-screen mode, press
Ctrl-Alt.



6. Disable the CDROM in VMware



Hopefully you chose to disable autorun on your CDROM drive when installing VMware. This is because, when a CDROM with an autorun file on it is inserted, the host machine and all guest operating systems would try to take control of it and read it.





To further prevent your virtual machines from wasting their time with CDROMs being inserted, you should disable the CDROM for each virtual machine. To do this, after selecting the proper tab for that virtual machine, go to
VM -> Settings (or press Ctrl-D). Inside the settings window, click on the CDROM drive. On the right-hand side, uncheck
Connected and Connect at Power-On, like this:








When done, click OK to save changes.



5. Separate Out Virtual Swap
Files Onto Separate Virtual Disks



Another way to increase performance on virtual machines is separate the swap files onto a separate host virtual and physical disks. In other words, currently, your swap file goes to the same virtual disk as all your other disk files. To increase performance, you would create a new virtual disk on a different host physical disk. You would then relocate your swap file to that new virtual disk. It won’t really be beneficial if you don’t relocate the new virtual disk to a new physical disk.





This is a more advanced topic and complex process so I won’t go into all the details in this article. However, to change the location of your swap file, you go to
Control Panel -> System -> Advanced Tab -> Performance Settings
-> Advanced Tab -> Virtual Memory Change
.




Of course, you hope that you don’t have to do much swapping. To prevent swapping, you should increase the size of the memory allocated to the virtual machine (within the size of your physical RAM). Note, see “Upgrade your RAM”, below.



4. Split Virtual Disks Among
Multiple Hard Disks



Anytime you can distribute data that is being utilized onto multiple disks, you will get greater performance. With VMware, this also applies. Say that you are running Microsoft SQL server or Exchange server. These applications have server programs, log files, and databases. Those three types of data could be split onto three separate virtual disks and those virtual disks could be placed on three separate physical disks.





Another way to distribute data across multiple disk spindles is to use a form of RAID. You could keep a single virtual disk a place it on a 5 disk RAID 5 stripe, for example. That would spread the data across multiple disk spindles, increasing performance for the virtual machine.



3. Upgrade Your Hard Disk



Upgrading your hard disk with a faster disk will always be a way to increase virtual machine performance. When you do this, your physical host disk is automatically defragmented because you had to backup and restore that data. Besides going with just a faster disk, you may be better going with multiple faster disks, if you can arrange that. Those disks could be put in a RAID array to provide redundancy and performance (depending on the type of RAID you select).



2. Upgrade Your CPU



The power of your CPU to process all the data from the host operating system, as well as these multiple virtual operating systems will be seriously stressed. As with any application, a faster CPU speed will always provide faster processing.



1. Upgrade Your RAM



In my opinion, you will get the most “bang for your buck” by upgrading your host system’s RAM. RAM is inexpensive these days (compared to CPU or disk) and these virtual machines are hungry for it. By upgrading your RAM, you can allocate more RAM to each virtual machine. This will prevent swapping on your host operating system and guest operating systems.





If you can’t afford additional RAM, another option is to reallocate RAM from one virtual machine to another. See how much RAM each machine is using. If one machine is doing more swapping and needs more RAM, perhaps it can be taken from another machine that isn’t doing much of anything. That is the beauty of virtual computing- sharing resources.







Summary



You have learned 10 different ways to increase the performances of your VMware workstation or server machines. There are software changes that can be made as well as hardware upgrades. Remember that your machine isn’t invincible and that running multiple computers inside one computer will quickly push your system, no matter how fast, to its limits. Use these 10 ways to increase performance to make your life (and your users’ lives) easier.>



Link : http://www.petri.co.il/virtual_increase_vmware_performance.htm

Improving VMWare Server performance on Windows XP

Over the last year, we have made a big push to move our development/test environments to a virtualized environment using VMWare Server. While we have not really encountered serious performance issues with our test servers, my team was reporting very poor performance with running the development virtual machines on their laptops. Now, keep in mind that these are pretty powerful laptops with 3 or 4GB of RAM, a T9300 dual-core processor, and a 7200RPM SATA hard drive. So there was more than enough horsepower to run WebSphere Portal in a virtual machine. However, the facts did not bear it out and in fact my team was reporting that running the virtual machine was in fact slowing their laptops down to a crawl with the constant hard disk access - a build that ought to take 5-10 seconds was taking several minutes. Obviously an unacceptable situation and people had reverted to just using a local WebSphere Portal install on their native OS - the issue with the local installs was that these local installs were not configured with LDAP or all the customizations/configurations that our test VMs have. When I found out about the issue and workaround and the fact that my pet initiative had fallen by the wayside, I felt challenged to resolve this issue. I tried it out on my own laptop and was able to reproduce this issue, and 2-3 hours later, I had the issue resolved.


To reiterate, the root cause of our performance woes was the excessive disk I/O being done by VMWare. Even though, we had plenty of RAM on our laptops and had more than enough RAM allocated to the Virtual Machine, what I noticed was that while VMWare would start by using significant amount of host RAM, over time it would release that RAM back to the host O/S. Once I realized what was going on, I did some Google searches and looked up the VMWare settings help, and had a resolution to my issue.


Here are the changes that I made to my laptop and to the VMWare settings to improve performance -




  1. Disable Memory Page Trimming


    VMware Server uses a memory trimming technique to return unused virtual machine memory to the host machine for other uses. Although trimming usually has little impact on performance and might be needed in low memory situations, the I/O caused by memory trimming can sometimes interfere with disk-oriented workload performance in a guest. To disable memory page trimming, check the Disable memory page trimming check box (Select: VM > Settings > Options > Advanced), and click OK.


    Given that I have enough RAM on my laptop, my first step to improve performance was to disable memory trimming for guest VMs.



  2. Disable real-time anti-virus protection


    Given the size of the VMWare virtual disk files and given that they are continuously being written to, I figured that my real-time anti-virus protection (Symantec AV) was probably not helping any with my disk I/O performance. So, I went ahead and excluded the VMEM (Virtual Memory - .vmem extension) and VMDK (VMWare Virtual Disk - .vmdk extension) files from the real-time scan.




  3. Disable memory sharing


    When the first two steps did not yield the results I wanted, I did some more searching and stumbled upon this default VMWare feature of page sharing that enables VMWare to save on memory usage if multiple virtual machines are running the same operating system or the same applications. I am not sure how this works in my scenario where I only have 1 virtual machine running at a time, but it certainly appeared to me that VMWare was scaling back its memory usage resulting in unnecessary disk I/O and this seemed like a possible culprit. I disabled memory sharing by adding a setting sched.mem.pshare.enable in my virtual machine configuration (.vmx) file like this:


    sched.mem.pshare.enable = “FALSE”



Well, these 3 settings did the trick for me! No more VMWare performance woes - the guest VM performs adequately without affecting performance of other applications on my host OS! Keep in mind, that you should also look into defragmenting your host disks and also shrinking your virtual disks for the best performance. I had already done these steps before I spent the time to track down the performance issues. Now, my team can go back to adopting the VMWare development virtual machines!




Link: http://vivekagarwal.wordpress.com/2008/07/08/improving-vmware-server-performance-on-windows-xp/

Wednesday, July 30, 2008

จะ Remove Package RPM บน Linux ทำอย่างไร

หากว่า ต้องการที่จะ Remove Package RPM บน Linux นั้นให้ทำโดย
1. เข้าไปหน้า Console จากนั้น Run command นี้
# rpm -e <ชื่อของ Package ที่ต้องการ remove>

Monday, July 28, 2008

"com.ibm.db2.jcc.c.SqlException: Invalid operation: result set closed"

solution: add this attribute to datasource


-> resultSetHoldability 1

Wednesday, February 20, 2008

จะใช้ Log4j ในพอท์เล็ตยังไง (Adding Logging to a Portlet?)

เคยใช้ System.out อยู่พักหนึ่ง รู้สึกว่า Performance มันตกๆ ไงไม่รู้
เลยลองเปลี่ยนมาใช้กับ Log4j ดู อาจจะช่วยได้ (รึป่าว) ^_^!

มาดูวิธี Set กันนะครับ

1. ก่อนอื่นก็ต้องไปดาวน์โหลด log4j มาก่อนสิ ไปที่นี่นะ http://logging.apache.org/log4j/1.2/download.html

2. เมื่อเราโหลดได้แล้ว แตกไฟล์มา จะมีเยอะมากมาย ให้หาไฟล์ นามสกุล .jar
มันจะอยู่นอกสุดอะครับ
เช่น
แตก zip มาจะได้ directory ชื่อ apache-log4j-1.2.15
c:/apache-log4j-1.2.15/log4j-1.2.15.jar

3. นำไฟล์ log4j-1.2.15.jar ที่ได้ไปวางไว้ใน path /WEB-INF/lib ของ Portlet นะ

4. จากนั้นสร้างไฟล์ log4j.properties โดยสร้างไฟล์นี้ไว้ ภายใต้ directory นี้
JavaResources/JavaSource

5. จากนั้นแก้ไขค่าในไฟล์ log4j.properties ตัวอย่างเช่น

# An example log4j configuration file.
log4j.rootLogger=DEBUG, FILE
log4j.appender.FILE=org.apache.log4j.FileAppender
log4j.appender.FILE.File=C:/log/SSOApplicationPortlet.log
log4j.appender.FILE.Append=true
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=[%-d{yyyy-MM-dd HH:mm:ss}] [%37c] %3x - %m%n

อยากได้รายละเอียดการใช้เพิ่มเติม ไปที่นี่นะครับ
http://logging.apache.org/log4j/1.2/manual.html

6. มาดู Portlet ของเราต่อ เมื่อเราเตรียมการใช้งาน Log4j เสร็จแล้ว เราจะมาดูการเรียกใช้ต่อนะ

7. ใน Class ที่เราต้องการ Debug หรือ จะเก็บ Log ให้เรา Import อันนี้เข้าไป

import org.apache.log4j.Logger;

จากนั้น ประกาศตัวแปร Global เพื่อเรียกใช้งาน log ดังนี้

private static Logger logger = Logger.getLogger(ชื่อClassPortlet.class);

และก็มาถึงการ out out outttttt log กัน อยาก เก็บดู Log ตรงไหน ให้ใช้แบบนี้

System.out.println("Start doView()"); // ไม่ใช้ละนะ

logger.debug("Start doView()"); // ใช้แบบนี้เอา

8. เสร็จแล้วการใช้งาน Log4j ถ้าจะไปดู output ก็ไปดูที่ path ที่เรา Set ไว้ใน log4j.properties นะครับ



ใช้งานแล้วเป็นยังไงกันมั่ง บอกกันด้วยนะ

Friday, February 15, 2008

How to set the Linux Host Name?

นานๆเปลี่ยนที เลยลืม command อ่ะ -*-

Step 1 : ตรวจสอบ host name ก่อน
using the following commands: หลายแบบ
#uname -n
#hostname -a
#hostname -s
#hostname -d
#hostname -f
#hostname

Step 2 : กำหนด hosts ใน /etc/hosts
ถ้าใช้ IP address ที่แจกให้โดย DHCP server, ใน/etc/hosts ให้ใส่ค่าตามนี้:

127.0.0.1 leokit.blogspot.com localhost.localdomain localhost leokit

ถ้าใช้ static IP address , ใน/etc/hosts ให้ใส่ค่าตามนี้:

127.0.0.1 localhost.localdomain localhost
192.168.0.1 leokit.blogspot.com leokit


Step 3 : Setting the Host Name using "hostname"
หลังจากแก้ไขใน hosts ไฟล์แล้ว ให้เรา run คำสั่งนี้
#hostname leokit.blogspot.com
Step 4 : ตรวจสอบ ใน /etc/HOSTNAME
leokit.blogspot.com
Step 5 : ตรวจสอบ ใน /etc/sysconfig/network
ถ้าใช้ static IP address , ใน/etc/sysconfig/network ให้ใส่ค่าตามนี้:
NETWORKING=yes
HOSTNAME="leokit.blogspot.com"

Step 6 : ตรวจสอบ ใน /proc/sys/kernael/hostname
ตรวจสอบโดยใช้ command
#cat /proc/sys/kernel/hostname

หลังจาก Set แล้วให้ทำการ reboot หรือจะ run คำสั่งนี้ก็ได้นะ
echo leokit.blogspot.com > /proc/sys/kernel/hostname

Thursday, February 14, 2008

วิธีการทำ RedHat 8.0 CD iso เป็น DVD iso

มาเริ่มกันเลยนะ
ทำเป็น CD ใช้ตั้ง 5 แผ่น เลยหาวิธีแปลงเป็น DVD เอาดีกว่า

ขั้นตอนทำ
1. เตรียมพื้นที่สำหรับวาง Image ทั้ง CD และที่จะทำเป็น DVD iso ไว้สัก 5-6 GB แล้วกัน (เหลือดีกว่า ขาด)

2. สร้าง Directories เพื่อที่จะได้ใช้ไว้ mount iso CD linux ทั้ง 5 แผ่น
จะสร้างทีก็ใช้ command นี้ละกัน (หมายเหตุ เพื่อไม่ให้งง ก็ไม่ต้องย้าย path ไปไหน)
#mkdir psyche-i386-disc{1,2,3,4,5} psyche-docs
เราก็จะได้ directories psyche-i386-disc1 ถึง psyche-i386-disc5 เพียงแค่กด Enter ครั้งเดียว ^0^

3. ทำการ mount ISO images ซะ
#mount -o ro,loop LinuxISO/psyche-i386-disc1.iso psyche-i386-disc1
#mount -o ro,loop LinuxISO/psyche-i386-disc2.iso psyche-i386-disc2
#mount -o ro,loop LinuxISO/psyche-i386-disc3.iso psyche-i386-disc3
#mount -o ro,loop LinuxISO/psyche-i386-disc4.iso psyche-i386-disc4
#mount -o ro,loop LinuxISO/psyche-i386-disc5.iso psyche-i386-disc5

4. copy isolinux กับไฟล์ .discinfo ที่อยู่ใน psyche-i386-disc1 ออกมาไว้ข้างนอก เพราะแก้ใน directory ที่เรา mount ไว้ไม่ได้อะ
#cp -a psyche-i386-disc1/isolinux psyche-i386-disc1/.discinfo .
**อย่าลืม จุด ด้านหลังสุดนะ ให้มัน copy ไว้ path ที่เราอยู่เลย

5. ได้ละ ไปแก้ไฟล์ที่ชื่อว่า .discinfo ก่อนประมาณบรรทัดที่ 4
ค่าปกติมันจะมีแต่ 1
ให้ทำการเติม 1,2,3,4,5 ตามแผ่นที่เราอยากจะสร้าง จะเอา 1,2,3 ก็ได้
save แล้วปิดซะ

6. ถึงนั้นตอนการสร้าง ISO ไฟล์ แล้ว command ยาวมาก ให้ใช้เครื่องหมาย \ เป็นตัวต่อด้านหลังนะ

# mkisofs -o psyche-i386-dvd.iso \
-b isolinux/isolinux.bin -c isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-R -m TRANS.TBL \
-x psyche-i386-disc1/.discinfo -x psyche-i386-disc1/isolinux \
-graft -points psyche-i386-disc1 .discinfo=.discinfo isolinux/=isolinux \
RedHat/=psyche-i386-disc2/RedHat RedHat/=psyche-i386-disc3/RedHat \
SRPMS/=psyche-i386-disc3/SRPMS SRPMS/=psyche-i386-disc4/SRPMS \
SRPMS/=psyche-i386-disc5/SRPMS docs/=psyche-docs

------------- ถ้าเป็น AS4 ใช้แบบนี้นะ
# mkisofs -o rh4up3-i386-dvd.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -m TRANS.TBL -x rh4-i386-disc1/.discinfo -x rh4-i386-disc1/isolinux -graft -points rh4-i386-disc1 .discinfo=.discinfo isolinux/=isolinux RedHat/=rh4-i386-disc2/RedHat RedHat/=rh4-i386-disc3/RedHat SRPMS/=rh4-i386-disc3/RedHat/RPMS SRPMS/=rh4-i386-disc4/RedHat/RPMS docs/=rh4-docs

7.จากนั้นก็ทำการ ไรท์ DVD ตามปกติเลย

*** จะ un-mount ใช้ คำสั่งนี้

#umount /media/iso

Friday, February 8, 2008

Step by Step Installation FFMpeg

Step by Step Installation ffmpeg

# wget http://ffmpeg.mplayerhq.hu/ffmpeg-ex...pshot.tar.bz2
# tar -xjvf ffmpeg-export-snapshot.tar.bz2
# cd ffmpeg-export-XXXXXXX
# ./configure --prefix=/usr/local
# make clean && make
# make install
# cd ..
# rm -rf ffmpeg*

Monday, February 4, 2008

Get 'uid' by Puma API

PUMA API :

เอาไว้ใช้ จัดการเกี่ยวกับ user หน่ะ

วันนี้เอาวิธีที่จะดึงข้อมูลของ 'uid' มาฝากนะ มั่วตั้งนาน หาก็ยาก ^0^


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

javax.naming.Context context = new javax.naming.InitialContext();
PortletServiceHome portletServiceHome = (PortletServiceHome) context.lookup("portletservice/com.ibm.portal.um.portletservice.PumaHome");


if (portletServiceHome != null) {
PumaHome service = (PumaHome) portletServiceHome.getPortletService(PumaHome.class);
PumaController pumaController = service.getController(request);
com.ibm.portal.puma.User user = (com.ibm.portal.puma.User) pumaController.getCurrentUser();

userId = user.get("uid").toString();

}

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

เห็นมะ ได้และ uid

Friday, February 1, 2008

ย้ายข้อมูลไปมาระหว่าง Using DB2 utilities to clone databases across different platforms

จะดึงข้อมูลมา Test บนเครื่องเราซะหน่อย แต่ดันข้าม platform
อ่ะๆ วิธีนี้ใช้ได้ทั้ง Windows<->Unix นะ


Linux -> Windows

ฝั่ง Linux นะ
1. db2look -d dbname -a -e -l -x -c -o dbname.log
หรือถ้าจะเอาเฉพาะ Table ก็ได้
db2look -d dbname -t tablename -a -e -l -x -c -o dbname.log

1.1 edit this file *.log change DB name in Script
2. db2move dbname export -aw
หรือระบุ Schema หรือ Table
db2move dbname export -aw -tn ชื่อtable -sn ชื่อschema

ฝั่ง Windows นะ
3. db2 -tvf path of file in 1.
4. db2move newdbname load > dbname.log

*Remark
When you transfer file FTP use ASCIIafter import Set Integrity TOO!

มาบอกอะไรตอนนี้ - ADD new Column to Table created.

สร้าง Table เสร็จไปละ
แต่อยากจะขอเก็บฟิลด์ข้อมูลเพิ่ม

ข้อมูลก็ใส่หมดละ ทำไงดีละนี่

หุหุ -*-

ทำตามนี่นะ
เช่น จะเพิ่ม ฟิลด์ SEX เข้าไปงี้

ALTER TABLE <ชื่อ table>
ADD SEX INTEGER
ADD ชื่อฟิลด์ใหม่ <ชนิดข้อมูล>

แค่นี้เอง
ลองๆดูนะจ๊ะ

Wednesday, January 30, 2008

การใส่ FLV ไว้บนเว็บแบบ ง่ายๆ

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

ใช้เจ้านี่เอา JW FLV MEDIA PLAYER กดโหลดได้ที่นี่

วิธีใช้ก็ง่ายๆ
1. เตรียมไฟล์ .flv ซะก่อนนะ ถ้าเป็นไฟล์อื่นก็หาโปรแกรมแปลงซะเน่อ
2. ก็ สร้าง HTML มา 1 หน้า แล้วดูตัวอย่างการใช้งานจากไฟล์ที่โหลด
3. upload แค่นั้นเอง ^0^ ง่ายเนอะ

แต่มันเป็น Streaming ไหมหว่า -*-

Tuesday, January 29, 2008

วิธีการ Set ULIMIT ใน UNIX

แก้ Config ของ OS แก้ไขใน
1. /etc/pam.d/login เพิ่ม
session required /lib/security/pam_limits.so

2. /etc/pam.d/sshd เพิ่ม
session required /lib/security/pam_limits.so

3. /etc/security/limits.conf เพิ่ม
* - nofile 10240



4. Restart server
*หมายเหตุ* ก่อนหน้าที่ทำการแก้ไข open file = 1024

-----------------------------------------
ดูค่า Config ทั้งหมด
# ulimit -a

กำหนดค่า Open file
#ulimit -n 2048

ดูว่าตอนนี้มีไฟล์เปิดอยู่เท่าไหร่กัน
# lsof grep REG wc -l

Monday, January 28, 2008

'Unable to compile class for JSP' error message occurs at runtime

ปัญหาที่เจอใน WebSphere Portal Server อะครับ
Search มาใส่ไว้ จะได้หาง่ายๆ ^_^
อ่อ แก้ ulimit ใน profile root เลยง่ายกว่านะ

ทางที่ดีนะ Up Fix work สุดๆ

Problem
An "Unable to compile class for JSP" error is thrown at runtime. See the complete error message below.
org.apache.jasper.JasperException: Unable to compile class for JSP/usr//temp//WebSphere_Portal///genjsp/.java:: error while writing : /usr/ /temp//WebSphere_Portal///genjsp/.class (Too many open files)(source unavailable)

Cause
The exception above is thrown when the operating system (OS) and JVM run out of file descriptors. File descriptors are unique to processes to identify open files of different types, including sockets or pipes. Exceptions indicating too many open files are thrown when the OS runs short of file descriptors.

Solution
There is a ulimit parameter in Linux that controls the number of files/connections that can be opened. You can find the current ulimit setting by entering the following command (ulimit -n). Ensure that this is set to at least 8192.