Aug 15, 2008

Install mod_encoding for apache

yum install httpd-devel
yum install autoconf
yum install automake
yum install texinfo
yum install glib
yum install glibc
・Install libiconv
mkdir /usr/local/src/libiconv
chmod 777 /usr/local/src/libiconv
cd /usr/local/src/libiconv
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.10.tar.gz
wget http://www2d.biglobe.ne.jp/~msyk/software/libico
nv/libiconv-1.10-ja-1.patch.gz
tar xzf libiconv-1.10.tar.gz
cd libiconv-1.10
gzip -dc ../libiconv-1.10-ja-1.patch.gz | patch -p1
./configure
make
make install
・Install mod_encoding
wget http://webdav.todo.gr.jp/download/mod_encoding-20021209.tar.gz
wget http://webdav.todo.gr.jp/download/experimental/mod_en
coding.c.apache2.20040616
gunzip -dc mod_encoding-20021209.tar.gz | tar xvf -
cd mod_encoding-20021209
./configure –with-apxs=/usr/sbin/apxs
cp ../mod_encoding.c.apache2.20040616 mod_encoding.c
cd lib
./configure
make
make install
vi /etc/ld.so.conf - edit
append /usr/local/lib to the end of /etc/ld.so.conf
ldconfig
cd ..
./configure –with-apxs=/usr/sbin/apxs –with-iconv-hook=/usr/local/include
edit mod_encoding.c
before change ap_regexec((regex_t *)
after change ap_regexec((ap_regex_t *)
before change ap_pregcomp(cmd->pool, arg, REG_EXTENDED|REG_ICASE|REG_NOSUB);
after change ap_pregcomp(cmd->pool, arg, AP_REG_EXTENDED | AP_REG_ICASE | AP_REG_NOSUB);
make
make install ←error
gcc -shared -o mod_encoding.so mod_encoding.o -Wc,-Wall -L/usr/local/lib -liconv_hook -liconv
cp mod_encoding.so /etc/httpd/modules/
httpd.conf

LoadModule encoding_module modules/mod_encoding.so

EncodingEngine on

SetServerEncoding UTF-8

DefaultClientEncoding UTF-8 MSSJIS EUC-JP

AddClientEncoding "Microsoft .* DAV 1.1" ASCII MSSJIS UTF-8
AddClientEncoding "Microsoft .* DAV" UTF-8 MSSJIS
AddClientEncoding "(Microsoft .* DAV $)" UTF-8 MSSJIS
AddClientEncoding "(Microsoft .* DAV 1.1)" MSSJIS UTF-8
AddClientEncoding "Microsoft-WebDAV*" UTF-8 MSSJIS
AddClientEncoding "RMA/*" MSSJIS
AddClientEncoding "xdwin9x/" MSSJIS
AddClientEncoding "cadaver/" UTF-8 EUC-JP
AddClientEncoding "Mozilla/" EUC-JP

Jun 15, 2008

Lenovo Thinkpad rescue cd disk

http://forum.thinkpads.com/viewtopic.php?t=56398

The Rescue and Recovery - Recovery repair diskette solves this problem.
But for those without a floppy drive, I've created a CD image (ISO) of the diskettes, using a PC with a floppy drive and MagicISO (here's a nice tutorial on how I did it).

Like the above link says:
Quote:
This package creates a bootable diskette that can be used to repair a corrupt boot sector on your primary hard drive. This package can also be used to reenable the F11 function as long as the service partition has not been removed from your hard drive.

This package supports Rescue and Recovery versions 1.0, 2.0, 3.0, 3.1, 4.0, 4.1 and 4.2.


Here are the download links (these ISOs were made at the 28th of January of 2007 - check if these really are the latest versions of the repair diskette):

Recovery repair CD for Windows 2000 and XP (rnr31_rrd.exe):
http://rapidshare.com/files/89450678/rnr31_rrd_fixed.iso

Recovery repair CD for Windows Vista (rnr40_rrd.exe):
http://rapidshare.com/files/89450908/rnr40_rrd_fixed.iso



Now burn the ISO image to a CD (using Nero, MagicISO, etc.) and restart your computer with the CD in the drive.
Note: Install the Rescue and Recovery software, before restoring the partition.


When booting from the CD (I only tested with the Vista diskette. I assume the same dialogues will appear with the XP and 2000 one):

You'll probably get a "Write protect error writing drive A: Abort, Retry Fail?" error. Just enter "F" to choose the Fail option (this error will appear several times. Just keep pressing "F" every time it appears).

You'll eventually get to a screen where you should choose the option "Option 1: Repair the current master boot record." (press ENTER).
After a few more Fails, a message saying "repairing... writing new mbr..." should appear. After pressing Fail again, you'll get a message saying "File creation error".
Finally another screen will appear with two option: "Press ENTER and continue" and "Press ENTER and continue" (yes, both options have the same text). CHOOSE THE SECOND ONE! (I lost a bit of time here, because I kept choosing the first option).
You'll see a few more error messages (continue pressing "F") and finally a screen saying "The operation was completed successfully". Press ENTER.
You'll probably get a few more "Fails"... After reaching the DOS prompt ("A:\>"), you can turn off the computer.
Note: Remember to eject the CD, or you'll boot again from it.

Now, when you press the ThinkVantage button you'll have the F11 option or you'll be redirected to Rescue and Recovery.

Windows Admin Hack

Using Windows Admin Hack to reset Administrator password of Windows XP

Fix windows boot

An NTLDR is compressed

Fix:

1. Boot to the recovery console
2. Type
cd \
attrib -c ntldr
exit

May 29, 2008

MySQL Cluster

1.What is MySQL Cluster?
Using
MySQL Cluster is a high-availability, high-redundancy version of MySQL adapted for the distributed computing environment.
It uses the NDBCLUSTER storage engine to enable running several MySQL servers in a cluster.
http://dev.mysql.com/doc/refman/5.0/en/mysql-cluster.html
Tech
MySQL Cluster is a technology that enables clustering of in-memory databases in a shared-nothing system(1).

2. Supported
Linux, Solaris, Mac OSX, HT-UX, and other Unix-style operating systems on a variety of hardware.
Cluster Supported Platforms list
3. Architecture
A MySQL Cluster consist of a set of computers, each running a one or more processes which may include a MySQL server, a data node, a management server, and (possibly) a specialized data access programs.

All these programs work together to form a MySQL Cluster. When data is stored in the NDBCLUSTER storage engine, the tables are stored in the data nodes. Such tables are directly accessible from all other MySQL servers in the cluster.
The data stored in the data nodes for MySQL Cluster can be mirrored.
MySQL Cluster's NDB storage engine contains a complete set of data, dependent only on other data within the cluster itself.
Currently, MySQL does not support multiple data nodes in a single server.

4. Keywords
Shared-nothing system(SN): is a distributed computing architecture in which each node is independent and self-sufficient, and there is no single point of contention across the system

May 21, 2008

Access HTTPS in Java

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

1. First of all you copy the URL that you are connecting to and paste it in your browser. Let us say you are using IE. Just paste the url in the address bar and press enter.

2. You will now probably see a dialog box warning you about the certificate. Now click on the 'View Certificate' and install the certificate. Ignore any warning messages.

3. Now that the server certificate is installed in your computer, your browser will not warn you when you visit the same site again. But however your JRE dumb as it is does not yet know about this certificate's existence until you add it to its keystore. Usually you will use the keytool to manage certificates. Keytool is a command-line utility with numerous arguments that allow you to create and manage keystores for housing digital certificates. For the complete documentation of keytool,http://java.sun.com/j2se/1.3/docs/tooldocs/win32/keytool.html

4. You can list the current certificates contained within a keystore using they keytool -list command. The initial password for the cacerts keystore is changeit. For example:

    C:\Program Files\Citrix\Citrix Extranet Server\SGJC\jre\bin>keytool -list -keystore ..\lib\security\cacerts

    Enter keystore password: changeit

    You will then see the something like this:

    Keystore type: jks

    Keystore provider: SUN

    Your keystore contains 11 entries:

    engweb, Wed Apr 11 16:22:49 EDT 2001, trustedCertEntry,

    Certificate fingerprint (MD5): 8C:24:DA:52:7A:4A:16:4B:8E:FB:67:44:C9:D2:E4:16

    thawtepersonalfreemailca, Fri Feb 12 15:12:16 EST 1999, trustedCertEntry,

    Certificate fingerprint (MD5): 1E:74:C3:86:3C:0C:35:C5:3E:C2:7F:EF:3C:AA:3C:D9

    thawtepersonalbasicca, Fri Feb 12 15:11:01 EST 1999, trustedCertEntry,

    Certificate fingerprint (MD5): E6:0B:D2:C9:CA:2D:88:DB:1A:71:0E:4B:78:EB:02:41

    verisignclass3ca, Mon Jun 29 13:05:51 EDT 1998, trustedCertEntry,

    Certificate fingerprint (MD5): 78:2A:02:DF:DB:2E:14:D5:A7:5F:0A:DF:B6:8E:9C:5D

    thawteserverca, Fri Feb 12 15:14:33 EST 1999, trustedCertEntry,

    Certificate fingerprint (MD5): C5:70:C4:A2:ED:53:78:0C:C8:10:53:81:64:CB:D0:1D

    thawtepersonalpremiumca, Fri Feb 12 15:13:21 EST 1999, trustedCertEntry,

    Certificate fingerprint (MD5): 3A:B2:DE:22:9A:20:93:49:F9:ED:C8:D2:8A:E7:68:0D

      verisignclass4ca, Mon Jun 29 13:06:57 EDT 1998, trustedCertEntry,

      Certificate fingerprint (MD5): 1B:D1:AD:17:8B:7F:22:13:24:F5:26:E2:5D:4E:B9:10

      verisignclass1ca, Mon Jun 29 13:06:17 EDT 1998, trustedCertEntry,

      Certificate fingerprint (MD5): 51:86:E8:1F:BC:B1:C3:71:B5:18:10:DB:5F:DC:F6:20

    verisignserverca, Mon Jun 29 13:07:34 EDT 1998, trustedCertEntry,

    Certificate fingerprint (MD5): 74:7B:82:03:43:F0:00:9E:6B:B3:EC:47:BF:85:A5:93

    thawtepremiumserverca, Fri Feb 12 15:15:26 EST 1999, trustedCertEntry,

    Certificate fingerprint (MD5): 06:9F:69:79:16:66:90:02:1B:8C:8C:A2:C3:07:6F:3A

    verisignclass2ca, Mon Jun 29 13:06:39 EDT 1998, trustedCertEntry,

    Certificate fingerprint (MD5): EC:40:7D:2B:76:52:67:05:2C:EA:F2:3A:4F:65:F0:D8

5. Now you have to add the previosly installed certificate to this keystore. To add, begin by exporting your CA Root certificate as a DER-encoded binary file and save it as C:\root.cer. (you can view the installed certificates under Tools->'Internet Options' ->Content->Certificates. Once you open the certificates, locate the one you just installed under 'Trusted Root Certification Authorities". Select the right one and click on 'export'. You can now save it (DER encoded binary) under your c: drive.

6. Then use the keytool -import command to import the file into your cacerts keystore.

For example:-alias myprivateroot -keystore ..\lib\security\cacerts -file c:\root.cer

Enter keystore password: changeit

Owner: CN=Division name, OU=Department, O=Your Company, L=Anytown,

ST=NC, C=US, EmailAddress=you@company.com

Issuer: CN=Division name, OU=Department, O=Your Company, L=Anytown,

ST=NC, C=US, EmailAddress=you@company.com

Serial number: 79805d77eecfadb147e84f8cc2a22106

Valid from: Wed Sep 19 14:15:10 EDT 2001 until: Mon Sep 19 14:23:20 EDT 2101

Certificate fingerprints:

MD5: B6:30:03:DC:6D:73:57:9B:F4:EE:13:16:C7:68:85:09

SHA1: B5:C3:BB:CA:34:DF:54:85:2A:E9:B2:05:E0:F7:84:1E:6E:E3:E7:68

Trust this certificate? [no]: yes

Certificate was added to keystore

7. Now run keytool -list again to verify that your private root certificate was added:

    C:\Program Files\Citrix\Citrix Extranet Server\SGJC\jre\bin>keytool -list -keystore ..\lib\security\cacerts

You will now see a list of all the certificates including the one you just added.

This confirms that your private root certificate has been added to the Extranet server cacerts keystore as a trusted certificate authority.

May 2, 2008

Configure network in CentOS5

$ vi /etc/sysconfig/network-scripts/ifcfg-eth0

for Static


DEVICE=eth0

ONBOOT=yes
HWADDR=00:0c:29:c3:90:85
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
IPADDR=172.16.1.3
NETMASK=255.255.0.0
GATEWAY=172.16.10.1

for dhcp

DEVICE=eth0
ONBOOT=yes
HWADDR=00:0c:29:c3:90:85
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
BOOTPROTO=dhcp