Friday, June 21, 2013

Install texlive 2012 on Ubuntu 12.04


sudo add-apt-repository ppa:texlive-backports/ppa
sudo apt-get update
sudo apt-get upgrade

Friday, May 10, 2013

How to change the title of an xterm

  • ESC]0;stringBEL – Set icon name and window title to string
  • ESC]1;stringBEL – Set icon name to string
  • ESC]2;stringBEL – Set window title to string
An xterm title of username@hostname: directory:
    echo -n "\033]0;${USER}@${HOST}\007"

For bash
    case $TERM in
        xterm*)
            PS1="\[\033]0;\u@\h: \w\007\]bash\\$ "
            ;;
        *)
            PS1="bash\\$ "
            ;;
    esac

For zsh
    case $TERM in
        xterm*)
            precmd () {print -Pn "\e]0;%n@%m: %~\a"}
            ;;
    esac

Sunday, April 21, 2013

Install Oracle Java 7 on Ubuntu

1. install java
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update 
sudo apt-get install oracle-java7-installer

2. switch java
sudo update-java-alternatives -l
sudo update-alternatives --config java
sudo update-alternatives --config javac

4. for Eclipse, in eclipse.ini
/usr/lib/jvm/jdk1.7.0/bin/java

Ignoring DTD in XMLUnit


@BeforeClass
public static void onlyOnce() {

 XMLUnit.setIgnoreWhitespace(true);
 XMLUnit.setIgnoreComments(true);
 XMLUnit.setIgnoreAttributeOrder(true);

 // don't validate dtd
 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
 dbf.setValidating(false);
 try {
   dbf.setFeature("http://xml.org/sax/features/namespaces", false);
   dbf.setFeature("http://xml.org/sax/features/validation", false);
   dbf.setFeature(
       "http://apache.org/xml/features/nonvalidating/load-dtd-grammar",
       false);
   dbf.setFeature(
       "http://apache.org/xml/features/nonvalidating/load-external-dtd",
       false);
 } catch (ParserConfigurationException e) {
   e.printStackTrace();
 }

 XMLUnit.setTestDocumentBuilderFactory(dbf);
 XMLUnit.setControlDocumentBuilderFactory(dbf);
}