Category Archives: Engineering

record something about programming

Many profilers, and I need at least one

Performance improvement is an ongoing task, always. So a profiler is a good friend. For me, the very basic tool is timing and print functions, lol. Yes, they are. In one of language tool, it helps to identify the parsing … Continue reading

Posted in Engineering | Leave a comment

Another Way of Javascript Method Overloading

In John Resig post, he presented a subtle method to support method overloading. It’s very useful when you have method overloading and each method behaves differently. However, it adds overhead by wrap up existing methods inside a new function. For … Continue reading

Posted in javascript, Web | Tagged | Leave a comment

Mercurial: How to ignore everything in a folder?

I have been looking for this for a while. It’s pretty simple. Let’s say you have project A, and want to ignore 2 folders: bin and output. 1. In your project folder, edit the file ‘.hgignore’, or create it if … Continue reading

Posted in Engineering | Leave a comment

Implement Unsigned Right Shift (>>>) if the Operator is Unsupported

If you are Java/Javascript/AS3 developer, you know what the >>> operator does. It is called unsigned right shift, or logical right shift. Check the definition in wikipedia. However, C# and C++ don’t have such operator for signed integers, though it … Continue reading

Posted in Engineering | Leave a comment

Get the real client IP address, when you use a reverse proxy

Let’s say you are running ASP.NET, PHP, JSP, or Python web. If the code is visited via reverse proxy, then the client IP address is the proxy IP with regular detecting routue. To fix the issue, let’s first take a … Continue reading

Posted in Server, Web | Tagged , | Leave a comment

Resolve ambiguities in antlr v3

When there is ambiguities in writing antlr grammar, there are different ways to solve it. 1. Simply avoid them. This is the ideal way when it’s possible. 2. Turn on backtracking, which is most inefficient way. 3. Use left factoring. … Continue reading

Posted in antlr | Leave a comment

ANTLR v3 Tutorials Aggregation

Here are some tutorial links for learning antlr v3: The Getting Started Tutorial from Official Site is Damn Good! ANTLR Works is a damn good tool! The Definitive Antlr Reference is a good book ANTLR 3.X Tutorials are good video … Continue reading

Posted in antlr, DSL, eclipse | Tagged , , | Leave a comment

Retrieve Line Numbers and Column Numbers in your ANTLR AST

We know that you can easily get the line numbers and column numbers information from the lexer token, via the properties: line & pos. When facing an Abstract Syntax Tree (AST), the rules may be rewritten so that the tree … Continue reading

Posted in antlr | Leave a comment

Set the source level to Java 6 for maven 2 compiler

By default, the source level is 1.3 in maven 2. We need to config maven compiler to use Java 1.6. Add the following snippet to your pom:

Posted in java, maven2 | Tagged , , | Leave a comment

Very nice video for Eclipse & ANTLR v3 development

If you are doing antlr v3 for Java, you can be very interested in this series of video tutorials. It demos how to develop with antlr3 IDE, and also the process of a small language. It credits to Marcel for … Continue reading

Posted in antlr, java | Tagged , , , | Leave a comment

Something interesting in the Language “GO”

Recently I noticed many languages released or emerged, such as GO, NOOP, Simple for Android, and the one by vim author (sorry I cannot remember it). Days ago, Google released a new language named ‘GO’. It is available at This … Continue reading

Posted in DSL | Leave a comment

Nice GEF Tutorial

GEF involves many concepts as it establishes its MVC convention. You may find tutorials from eclipse official site spend most paragraphs in concept explanation. Here is a very nice tutorial focusing on step-by-step application. It’s not long, around 80 pages … Continue reading

Posted in eclipse | Tagged , , | Leave a comment

Eclipse: Dynamically Adjust Widget Size and Reflow a Form Page

Let’s say you need to dynamically adjust a widget size, and then update scroll bar information. Things are pretty simple, if we understand how eclipse layout works. I have a PageBook widget, and wish to resize the form page as … Continue reading

Posted in eclipse, java | Leave a comment

Code Snippet to use PageBook

Below is very straightforward code snippet to use PageBook. It is used together with eclipse form. Therefore you will see widgets are created via the FormToolkit class.

Posted in eclipse, java | Tagged , , , , | Leave a comment

Use maven dependency plugin to copy all dependencies to a folder

In some cases, we’d like to get all the dependency jar files for a project. There is a maven plugin to do it simply, via a simple way. Just add the build sections to your pom file, as shown below: … Continue reading

Posted in java, maven2 | Tagged , , | Leave a comment