How to install pip and create virtualenv on Windows without administrative permission

Since Python 2.7.9, pip is released together with the Python. But I still cannot find it when our administrator installed the latest python on my PC. How to install pip, then create virtualenv on Windows without the administrative permission?

  1. Download
  2. Run python --user. It will install pip locally.
  3. Install virtualenv by running python -m pip install --user virtualenv. This will install the package of virtualenv
  4. Run python -m virtualenv ENV to create a new virtual environment. ENV is a directory to place the new virtual environment.
  5. Activate the script by running ENV/Scripts/activate.bat.

read more

Using Bibtex in MS Word 2015 (Mac OS)

BibTeX is reference management software for formatting lists of references. It makes it easy to cite sources in a consistent manner. However, BibTex is typically used together with the LaTeX document preparation system.

On the other hand, Microsoft Word is still the most commonly used text editor and used in the group to share documents. Thus, I use BibTex to manage the bibliography and use MS Word to write documents.
One of the most famous reference manager software integrated in Word is EndNot, but unfortunately it is a very expensive and not open-source software. In Windows OS, there is a awesome plug-in called “Bib4Word”, but it is not usable in Max OS.

read more

Where to place you own .sty or .cls files, to make them available to all my .tex files?

Suppose you have defined a package or a class, but how do you make it available at all times? One way is to just place it in the same folder as the .tex file, but that’s not what I’m after here. This post will tell you a way to “install” the package centrally on your computer.

1. Find out the directory. First, use this command at the command prompt to find out where your TeX home directory is.

kpsewhich -var-value=TEXMFHOME
OS Location
Windows C:/Users/stefan/texmf
Unix-type ~/texmf/
Mac ~/Library/texmf

2. Place files in the “right place”. Following the TeX directory structure, you should place your file in the “right place” like ~/texmf/tex/latex/packagename/packagename.sty. For a TDS-conformant system (TeX Directory Structure), the “right place” for a LaTeX .sty file is a suitably-named subdirectory of texmf/tex/latex/. For a full list of “right place”s, please see LaTeX/Installing Extra Packages. Moreover, for the beamer style, put the theme under beamer/themes/ with “color”, “font”, “inner”, “outer”, and “theme” in seperated subdirectories.

read more

Dropbox icon is not working Xubuntu 16.04 LTS

After upgrading to Xubuntu 16.04, I found that the dropbox icon stopped working. The icon is black with a red slashed zero. I cannot click on it to bring up the dropbox menu.

The reason is that Dropbox starts to use “indicator area” for their tray icon instead of “notification area”. The problem can be fixed by running

$ dropbox stop && DBUS_SESSION_BUS_ADDRESS="" dropbox start


$ dropbox stop && dbus-launch dropbox start

How to ignore namespace when selcting XML nodes with XPath

I have several full article in PMC XML format to parse. I plan to use XPath. However, the namespace always breaks my path. For example, in the following XML I cannot use *//article-id to retrieve all article-id tags. Instead, I have to use *//{}article-id. As you can see, it is really painful.

<?xml version="1.0" encoding="UTF-8"?><OAI-PMH
    <request verb="GetRecord" identifier="" metadataPrefix="pmc"></request>
                <article xmlns:xlink="" xmlns:mml="" xmlns:xsi="" xmlns="" xsi:schemaLocation="" article-type="research-article">
                          <article-id pub-id-type="accession">PMC2702331</article-id>
                          <article-id pub-id-type="pmcid">PMC2702331</article-id>
                          <article-id pub-id-type="pmc-uid">2702331</article-id>
                          <article-id pub-id-type="publisher-id">1742-4690-6-47</article-id>
                          <article-id pub-id-type="pmid">19454010</article-id>

read more

How to return an subclass with generics

In 2013, I created a project to provide a general-purpose tree structure in Java.

One challenge at that time (mostly because I was not an expertise at that time, neither am I now) is the return type of Tree methods. For example, the return type of getChild(int index) that should return the child at the specified index.

read more

How to use Whatizit Web Services in Java

Whatizit is a text processing system that allows you to do textmining tasks on text. It is also available as a Web Service whose underlying idea is to ensure that software from various sources work well together. Whatizit is built on open standards of Simple Object Access Protocol (SOAP) and Web Services Description Language (WSDL). For the transport layer itself, Web Services uses most of the commonly available network protocols, especially Hypertext Transfer Protocol (HTTP). For more information on WSDL please refer to the W3C WSDL v1.1 Document.

read more

How to submit a package to PyPI

How to submit a package to PyPI

PyPI (Python Package Index) is a repository of software for the Python programming language. This article will tell you how to submit your package to PyPI, so others are able to install it with easy_install or pip. The offical document is at

Create your accounts

You must create accounts on PyPI Live and PyPI Test before upload your code.

After registration, create a pypirc configuration file at ~/. This file holds your information for authenticating with PyPI, both the live and the test versions.

index-servers =

username: {{your_username}}
password: {{your_password}}

username: {{your_username}}
password: {{your_password}}

Prepare your package

Every package on PyPI needs to have a file called at the root of the directory. If you are using a markdown-formatted README file you’ll also need a setup.cfg file. Also, you’ll want a LICENSE.txt file describing what can be done with your code. So the directory structure would look like this:


This is metadata about your library.

from distutils.core import setup
  name = 'mypackage',
  packages = ['mypackage'],
  version = '0.1',
  description = 'A random test lib',
  author = 'Peter Downs',
  author_email = 'your email address',
  url = '',
  keywords = ['testing', 'logging', 'example'],
  classifiers = [],

read more

How to create a Web Application Project with Java/Maven/Jetty

How to create a Web Application Project with Java/Maven/Jetty or Tomcat

In this article, we create a simple web application with the Maven Archetype plugin. We’ll run this web application in a Servlet container named Jetty, add some dependencies, write simple Servlets, and generate a WAR file. At the end of this article, you will also be able to deploy the service in Tomcat.

System requirements

Creating the Web Service Step by Step

This section explains how to create this simple web project from an EMPTY folder.

Creating the Simple Web Project

To create your web application

$ mvn archetype:generate -DgroupId=com.pengyifan.simpleweb \
      -DartifactId=simple-webapp \
      -Dpackage=com.pengyifan.simpleweb \
      -DarchetypeArtifactId=maven-archetype-webapp \
      -Dversion=1.0-SNAPSHOT \


Once the Maven Archetype plugin creates the project, change the directory into the simple-webapp directory and take a look at the pom.xml. You should see the

<project xmlns="" 
  <name>simple-webapp Maven Webapp</name>

read more