Archive for the ‘Lang Code’ Category

How to indicate the java compiler version and target version

Saturday, May 3rd, 2008

By default, the maven will use the compiler source check level to 1.3 and target version to 1.1 for maximum artifact compatibility. However, in most of your project, you don’t need such compatibility. In contrast, you will want to use more recently language features: like assertion, generic type of container, and so on. You can do that be indicate the compiler source and target requirement.

First, from Eclipse IDE, select “maven – add plugin”, add the maven-compiler-plugin, the lastest version should be 2.02. This will add some elements to you pom.xml like:

...
<build>
  <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.0.2</version>
      </plugin>
  </plugins>
</build>
...

you can add attibutes after version, like:

<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
    <source>1.6</source>
    <target>1.6</target>
</configuration>

This will set the source check and target check version to jre 6.0. You will notice that although sun has change this naming scheme from 1.x to x.0 from jre 5.0 on, but maven still using 1.x scheme.

Share

Use log4j-1.2.14 instead of 1.2.15 in Maven Project

Saturday, May 3rd, 2008

log4j-1.2.15 has a dependency on sun-jms-1.1, which is broken in Maven repository.

Share

Maven

Monday, April 28th, 2008

These few days, I have special interests on maven. A java ( well, I am not sure if it is Java only) building tool.

The reason I am looking for a building tool is we are currently changing our development tool chain from NetBeans to Eclipse ( Some Windows nuts insist on JBuilder, which is based on Eclipse as well ). The problem is we have to do a lot to convert the projects to eclipse ones and have them built under eclipse. So, we want to find an IDE neutral build environment.

what is Maven?

Maven, a Yiddish word meaning accumulator of knowledge , was originally started as an attempt to simplify the build processes in the Jakarta Turbine project. There were several projects each with their own Ant build files that were all slightly different and JARs were checked into CVS. We wanted a standard way to build the projects, a clear definition of what the project consisted of, an easy way to publish project information and a way to share JARs across several projects.

The result is a tool that can now be used for building and managing any Java-based project. We hope that we have created something that will make the day-to-day work of Java developers easier and generally help with the comprehension of any Java-based project.

Maven’s Objectives

Maven’s primary goal is to allow a developer to comprehend the complete state of a development effort in the shortest period of time. In order to attain this goal there are several areas of concern that Maven attempts to deal with:

  • Making the build process easy
  • Providing a uniform build system
  • Providing quality project information
  • Providing guidelines for best practices development
  • Allowing transparent migration to new features
Share

SSH no password login

Wednesday, December 19th, 2007

first, on your local machine, generate the key pair:

ssh-keygen -t dsa

Copy public key file .ssh/id_dsa.pub to server you are going to login.

Append the key to .ssh/authorized_keys by

cat id_dsa.pub >> .ssh/authorized_keys
Share

Why Chinese words change to ??? after upgraded to WP 2.2

Saturday, September 8th, 2007

I saw a lot of complains about after upgraded to WP 2.2, the display of Chinese display is not correct any more. The reason looks like WP now assume the charset using in database storage is UTF-8, which is usually not true. More over, the scripts of WP creating the database tables will use sweden_ci as default.

So, you have to change the every fields in WP’s database to utf8_unicode_ci to make it handles Chinese characters correctly.

Share

Browser behavior while sending referrer URL

Saturday, August 25th, 2007

Some times we need to determine the referrer URL. For example, an online advertising company wants to display special information based on which page its audience is looking at. A common way is checking the referrer URL of the current scripts page then embedded in the publisher’s pages.

However, different browser may have different behavior while sending the referrer URL in HTTP request header. Most of browsers except IE will escape the path and query part to % form, and this is what the standard required. IE will convert the query part to UTF-8 encoding before sending it, while other browsers will just leave it as the current encoding using for display. For Firefox, it will be a little bit more complicated, since it can be configured by the about:config page.

Here are some examples:

  • search.php?q=one two, will be sent as it is by IE, and be sent as search.php?q=one%20two by others.
  • search.php?q=中文, will be sent as it is by IE, however, the Chinese charactes are encoding to UTF-8 no matter what encoding the page is. For other browser, it will be sent as search.php?q=%E4%B8%AD%E6%96%87 if search.php is displayed using UTF-8 or as search.php?q=%D6%D0%CE%C4 if search.php is displayed using GB2312.

I will try to give in depth explanation on this issue in the coming articles. Stay tune!

Share

Hello world!

Wednesday, August 15th, 2007

Hi, there! Welcome to my new blog space. After fooling around in a boring summer afternoon, I set up this blog.

In this blog, I am going to share with you guys my researches on Computerized Linguistic Processing and Web crawling. It will cover technologies of online advertising, more precisely contextual advertising. This is what my linguistic processing project will be used for. Also, we will cover the computer programming tools, like C/C++, Perl, Java, PHP, javascript as well as the OS platform I am using: Linux and Mac OS X.

Sometimes, I will be off-topic and talking about the news and other funny stuffs.

Hope you enjoy it!

Share