Category Archives: java

Base64 Encoding in Android 2.1 or Earlier

Base64 is common used. Now Google added a utility class android.util.Base64. Unfortunately it is only available in Android 2.2 and later. So, you need just a little bit work to use it with Android 2.1 or ealier. Yes, just copy … Continue reading

Posted in android, java, python | Tagged , , | 3 Comments

A simple thrift tutorial

Check it out at http://skorage.org/2009/03/08/simple-thrift-tutorial/

Posted in java | 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

Quick Example to Java Scripting Engine

Have you heard that Java support scripting engine? Try the source code below:

Posted in java | 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

Yahoo API & web services

Recently I am interested in Yahoo API and web services, especially inquirying finance data via the APIs. Yahoo provides nice language support. For example, python is supported at http://developer.yahoo.com/python/ At the bottom of the page, you can find a list … Continue reading

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

The DSL implementation work

I started to experiment Domain-Specific Language (DSL) implementation two weeks ago. The tool I use is antlr v3. We know that Xtext, TCS, Boo are good DSL toolkit. The reason why we don’t use them for now, is because you … Continue reading

Posted in DSL, java | Tagged , , , , , , , , | 2 Comments

Reading notes: Textual DSLs and eclipse modeling (part 2)

Part 1 of the notes is located at http://www.frankdu.com/weblog/archives/46 The relative presentation slide is located at openArchitectureWare.org. 23. In XText, you start to work with defining concret syntax. 24. For existing meta model, use importMetamodel directive. Use preventMMGeneration to prvent … Continue reading

Posted in DSL, eclipse, java | Tagged , , , , , , , , , | 1 Comment

Reading notes: Textual DSLs and eclipse modeling (part 1)

The relative presentation slide is located at openArchitectureWare.org. Part 2 of the notes is located at http://www.frankdu.com/weblog/archives/52 Below are my reading notes for Textual DSLs and text modeling in eclipse. I haven’t finished the ppt slides. Therefore, this is only … Continue reading

Posted in DSL, eclipse, java | Tagged , , , , , , , , , | 1 Comment

Eclipse: how to implement actions for annotation markers?

In the text editor, the markers are displayed on the vertical ruler. In Java source editor (CompilationUnitEditor class), you can click a problem marker, then a suggestion list will pop up. It’s pretty user friendly, isn’t it? Then, how to … Continue reading

Posted in eclipse, java | Tagged , , , , , , , | 1 Comment

How to open a perspective and view programmatically in eclipse?

It is very straightforward. Though there are other ways, I will only present one way for now:

Please note: Of course you need to add the error handling code as prompted by eclipse.

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

How to invoke an action from eclipse Welcome page?

Let’s start from the template intro project. In the root.xhtml file, add a link as below: <a href=”http://org.eclipse.ui.intro/runAction?pluginId=com.frank.workbench.demo&amp;class=com.frankdu.workbench.actions.InstallRemoteFeatureAction”> Test Install Action</a> Then you are done. The next step is to impelement the action. Please note: pay attention to the texts … Continue reading

Posted in eclipse, java | Tagged , , | 1 Comment