The Answer to Life, the Universe, and Everything

Friday, November 30, 2007

Trac Installation

For Ubuntu 7.10.

$ apt-get install trac
$ sudo mkdir /var/trac
$ cd /var/trac
$ trac-admin test initenv
$ chown -R www-data ./test

$ apt-get install libapache2-mod-python
$ vi /etc/apache2/sites-available/trac
--
Alias /trac "/usr/share/trac/htdocs/"

<Location "/tracsvn">
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracUriRoot "/tracsvn"
PythonOption TracEnvParentDir /var/local/trac
AuthType Basic
AuthName "DoJa Repository"
AuthUserFile /etc/subversion/passwd
Require valid-user
SSLRequireSSL
</Location>
--
$ a2ensite trac
$ /etc/init.d/apache2 reload

Subversion Installation

For Ubuntu 7.10
$ sudo apt-get install subversion libapache2-svn
$ sudo mkdir /var/svn
$ sudo svnadmin create /var/svn/$REPOS
$ sudo chown -R www-data:www-data /var/svn/$REPOS
$ sudo chmod -R g+ws /var/svn/$REPOS


Only allowing to access by SSL
$ sudo a2enmod ssl
$ sudo apt-get install ssl-cert

#In order to change the valid days up to 10years
#vi /usr/sbin/make-ssl-cert
--
openssl req -config $TMPFILE -new -days 365 -x509 -nodes -out $output -keyout $output > /dev/null 2>&1
--
$ sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
$ sudo chmod a+r /etc/apache2/ssl/apache.pem

$ cp /etc/apache2/sites-available/default /etc/apache2/sites-available/$SITENAME
$ sudo vim /etc/apache2/sites-available/$SITENAME
change:
NameVirtualHost *:443

add:
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLProtocol all
SSLCipherSuite HIGH:MEDIUM

Thursday, November 29, 2007

MySQL Encoding

You need to change params for the server and the client.
# Change MySQL server encode
# By calling the following SQL you can see the current encoding.
# show create table xxx;
# show variables like 'char%';

mysql$ alter table xxx character set utf8;
mysql$ alter table xxx change sub1 sub1 varchar(256) character set utf8;
mysql$ set names utf8;
mysql$ set character_set_database=utf8
mysql$ set character_set_server=utf8

#On the client to connet to DB set the following param in URL
jdbc:mysql://localhost/blojsom?autoReconnect=true&useUnicode=true&characterEncoding=utf-8

Bind Reload

Bind reload command differs from the 8 or 9.
#Bind8
#/usr/sbin/ndc reload

#Bind9
#/usr/sbin/rndc reload

Friday, November 23, 2007

Eclipse Heap Memory

This is how you can change the memory for Eclipse to use.

#vim $ECLIPSE_HOME/eclipse.ini
--
-vmargs
-Xms64m
-Xmx256m

Tomcat Heap Memory

Here is the how we can change the setting of the memory used for tomcat.

set CATALINA_OPTS="-Xms512m -Xmx512m"  (Windows)
export CATALINA_OPTS="-Xms512m -Xmx512m" (ksh/bash)
setenv CATALINA_OPTS "-Xms512m -Xmx512m" (tcsh/csh)

Java:Loading the file

The dev environment and the actual service server are different and often face the problem of path to the config file with FileNotFound Exception or so. Here is a solution.

URL propXML = this.getClass().getResource(RESFILE);
Configuration config = new XMLConfiguration(propXML);


or

ClassLoader loader = Thread.currentThread().getContextClassLoader();
DOMConfigurator.configure(loader.getResource("log4j.xml"));

Friday, November 16, 2007

Ubuntu: Change Timezone

The way to change the timezone.

root # ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
root # date -d