Archive for September, 2006

Java – char to ascii integer and back

System.out.println((int)’A');
System.out.println((char)65);

Comments (1)

Upgrade JSTL from 1.0 to 1.1

  1. Use Tomcat >5.0
  2. Download jstl.jar and standard.jar to WEB-INF/lib
  3. Change include tag from
    <%@ taglib prefix=”c” uri=”http://java.sun.com/jstl/core” %>
    <%@ taglib prefix=”fmt” uri=”http://java.sun.com/jstl/fmt” %>
    to
    <%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core” %>
    <%@ taglib prefix=”fmt” uri=”http://java.sun.com/jsp/jstl/fmt” %>
  4. In web.xml, use tag
    <web-app xmlns=”http://java.sun.com/xml/ns/j2ee”
    xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
    xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd”
    version=”2.4″>

Leave a Comment

Solution for error: Tomcat:port already in use

If port is 8080:

$ netstat -nab | grep 8080

TCP 127.0.0.1:8080 127.0.0.1:1968 CLOSE_WAIT 2112
TCP 127.0.0.1:8080 127.0.0.1:2025 CLOSE_WAIT 2112
TCP 127.0.0.1:8080 127.0.0.1:1964 CLOSE_WAIT 2112
$ ps -e | grep 2112

2112 3:47 java

$ kill 2112

Comments (1)

on delete cascade in mySQL

When using “on delete cascade” in mySQL,

  1. use INNODB;
  2. index foreign key field.

Example:

create table user ( user_id bigint(20) unsigned not null auto_increment primary key) ENGINE=INNODB;

create table foto (
foto_id bigint(20) unsigned not null auto_increment primary key,
user_id bigint(20) unsigned not null,
index (user_id),
foreign key (user_id) references user (user_id) on delete cascade on update no action
) ENGINE=INNODB;

mySQL reference

Comments (2)