Tag 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

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

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

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

SWTbot: Automatic GUI Testing for RCP/SWT/Eclipse Programs

I finally sat down and spent two hours on using SWTbot. It is a automatic GUI testing tool for RCP/SWT programs. If you are writing AWT/Swing programs, it’s not for you. For AWT/Swing, you may want abbot. I experienced several … Continue reading

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

Video Demo of External DSL by oAW Xtext

These three videos are very helpful: http://www.openarchitectureware.org/screencasts/externaldsl_part1.htm http://www.openarchitectureware.org/screencasts/externaldsl_part2.htm http://www.openarchitectureware.org/screencasts/externaldsl_part3.htm

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

Encoding Problem with HttpClient

HttpClient looks very nice, as it supports many HTTP actions. I tried the webpage download code, but encountered an encoding issues with Chinese web pages. Language encoding is always a problem for non-English developers, especially Asian developers, whose languages are … Continue reading

Posted in java | Tagged , , | Leave a comment

Writing an XML Editor using JFace Text Framework

I am trying to write an XML Editor using JFace Text Framework. I started from the default XML Editor template created by eclipse. The editor is much more powerful than the very beginning. What I have finished during the weekend … Continue reading

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