# Using regex to hanging indent a paragraph in Java

This post shows how to hanging indent a long paragraph using regular expression. The method will consider word boundaries, which means it will not break words for the indentation. To illustrate the problem, consider the following example

There has been an increasing effort in recent years to extract relations between entities from natural language text. In this dissertation, I will focus on various aspects of recognizing biomedical relations between entities reported in scientific articles.

The output should be

There has been an increasing effort in recent years to extract relations between
entities from natural language text. In this dissertation, I will focus on
various aspects of recognizing biomedical relations between entities reported
in scientific articles.


### My method

We need a regular expression to break the paragraph into a sequence of strings with fixed length. Suppose the text width is 80 and the indent is 3, the length of first string is 80. All remainders’ length is 77.

The main process of the algorithm is read moreMore

# My PhD Proposal Defense: A Study of Relation Extraction

There has been an increasing effort in recent years to extract relations between entities from natural language text. In this dissertation, I will focus on various aspects of recognizing biomedical relations between entities reported in scientific articles.

Approaches to the relation extraction task can be categorized into two major classes: (1) pattern-based approaches and (2) machine learning-based approaches. Pattern-based approaches often use manually-designed rules to extract relations. read moreMore

# dpkg: error processing tex-common

Got the problem while installing latex-cjk-chinese

fmtutil-sys failed. Output has been stored in
/tmp/fmtutil.t6EnBlWW
Please include this file if you report a bug.

dpkg: error processing tex-common (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
tex-common
E: Sub-process /usr/bin/dpkg returned an error code (1)


After checking the file fmtutil.t6EnBlWW, I find the problem is

! I can’t find file loadhyph-zh-latn.tex’.

This is due to the inconsistence between texlive 2011 and tex2012. In tex2012, the file is renamed to loadhyph-zh-latn-pinyin.tex’. Therefore, the solution read moreMore

# Recommend: The Science of Scientific Writing

George Gopen and Judith Swan. The Science of Scientific Writing. American Scientist. 1990, 78: 550-558.

Our examples of scientific writing have ranged from the merely cloudy to the virtually opaque; yet all of them could be made significantly more comprehensible by observing the following structural principles:

1. Follow a grammatical subject as soon as possible with its verb.
2. Place in the stress position the “new information” you want the reader to emphasize.
3. Place the person or thing whose “story” a sentence is telling at the beginning of the sentence, in the topic position.
4. Place appropriate “old information” (material already stated in the discourse) in the topic position for linkage backward and contextualization forward.
5. Articulate the action of every clause or sentence in its verb.
7. In general, try to ensure that the relative emphases of the substance coincide with the relative expectations for emphasis raised by the structure.

# 函数式编程的另类指南(9)

The following part is not maintained anymore. Please go to 函数式程序设计的另类指南 for the whole translation.

## Continuations

Continuations对于程序设计的意义，就像《达芬奇密码》对人类历史的意义：揭露了人类有史以来最大的假象。恩，也许没那么牛。但它在概念上的突破性至少和开方负数的意义相同。

# 函数式编程的另类指南(11)

The following part is not maintained anymore. Please go to 函数式程序设计的另类指南 for the whole translation.

# Install brat on Apache2

## Install brat

download, unzip and run ./install.

## Change the webapp location in Apache2

1. in etc/apache2/sites-avialble, in default add Alias /brat "/home/brat"
2. restart apache2:
sudo service apache2 reload


# Install texlive 2012/2013 on Ubuntu 12.04

### From repository

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