Sunday November 26, 2006 Eclipse Wikipedia Editor plugin 2.0.6 released
I released the Eclipse Wikipedia Editor plugin version 2.0.6.
You can download it here:
Usage:
Changes:
*.wp in the package explorer, the browser views the rendered HTML output from the corresponding file in the /wpbin subdirectory.
MathEclipse Parser API 0.0.4 released
The Math Parser API is used in the Math Eclipse Plugin for parsing math expressions. The expression parser is driven by an operator table as described in this Wikipedia article:
Download
The latest API is available as meparser.jar in this source code download:
Usage
This is a wiki page describing the Math Parser API
Related Links
Google MathEclipse news and discussion group:
MathEclipse homepage:
Example
This is a JUnit example for parsing a math string expression into an abstract syntax tree node (ASTNode):
public void testParser1() {
try {
Parser p = new Parser();
ASTNode obj = p.parseExpression("Integrate[Sin[x]^2+3*x^4, x]");
assertEquals(obj.toString(),
"Integrate[Plus[Power[Sin[x], 2], Times[3, Power[x, 4]]], x]");
} catch (Exception e) {
e.printStackTrace();
}
}
Posted by axelclk
( Oct 08 2006, 01:48:45 PM CEST )
Permalink
Comments [0]
Bliki Wikipedia Syntax rendering engine 2.0.5 released
The Bliki engine API supports the rendering of a Wikipedia article into HTML.
Download:
Description of the API usage:
The download contains the following parts
info.bliki.wiki/bliki.jar is a precompiled binary for the API
BlikiParser.java and JAMWikiModel.java parser files for JAMWiki.org (see the demo page at: http://www.bliki.info.jamwiki )
A simple wiki to html fragment looks like this:
public static void main(String[] args)
{
WikiModel wikiModel =
new WikiModel("${image}", "${title}");
String htmlStr = wikiModel.render(" [[Hello World]] wiki tag");
System.out.print(htmlStr);
}
Posted by axelclk
( Oct 08 2006, 12:18:03 PM CEST )
Permalink
Comments [0]
Eclipse Wikipedia Editor plugin version 2.0.5 released
I released version 2.0.5 of the Eclipse Wikipedia Editor plugin.
You can download the plugin here:
You can view the installation description here:
The Wikipedia Plugin contains a Wikipedia Syntax Editor with the following features:
Running JAMWiki with own parser
I've setup a JAMWiki demo instance
which uses the syntax parser from my Eclipse Wikipedia plugin project
Posted by axelclk ( Sep 14 2006, 08:32:03 PM CEST ) Permalink Comments [0]JAMWiki - some Wikipedia Syntax JUnit tests
To test the Wikipedia syntax parser in the JAMWiki project I created some simple JUnit tests.
Some test results:
ParserInput.MODE_SAVE mode to create a user signature rendering test
testPreformatedText1 the opening <pre> block was never closed
Here is the implementation:
At first a general support class for JAMWiki JUnit tests:
package org.jamwiki.parser;
import java.util.Locale;
import junit.framework.TestCase;
import org.jamwiki.model.WikiUser;
import org.jamwiki.utils.Utilities;
/**
* Support class for defining JUnit Wiki synatx tests.
*
*/
public class JAMWikiTestSupport extends TestCase
{
protected ParserInput parserInput;
public JAMWikiTestSupport(String name)
{
super(name);
}
protected void setUp() throws Exception
{
super.setUp();
parserInput = new ParserInput();
parserInput.setContext("context/path");
parserInput.setLocale(Locale.ENGLISH);
WikiUser testUser = new WikiUser();
testUser.setFirstName("Mr.");
testUser.setLastName("Tester");
testUser.setDisplayName("displayName");
testUser.setLogin("dummy");
parserInput.setWikiUser(testUser);
parserInput.setUserIpAddress("127.0.0.1");
parserInput.setVirtualWiki("en");
parserInput.setAllowSectionEdit(true);
parserInput.setMode(ParserInput.MODE_SAVE);
}
protected void check(String rawWikiText, String expectedHTMLResult)
{
check(rawWikiText, expectedHTMLResult, "Test Topic");
}
protected void check(String rawWikiText, String expectedHTMLResult, String topic)
{
parserInput.setTopicName(topic);
try {
ParserOutput parserOutput = Utilities.parse(parserInput, rawWikiText, topic);
assertEquals(expectedHTMLResult, parserOutput.getContent());
} catch (Exception e) {
e.printStackTrace();
}
}
}
This class defines some simple JUnit tests, to see what HTML output the JAMWiki parser generates:
package org.jamwiki.parser;
/**
* Class for defining some simple Wiki Syntax tests.
*
*/
public class SimpleParserTests extends JAMWikiTestSupport
{
public static final String TABLE_TEST = "{| width=\"100%\" cellspacing=\"3\" cellpadding=\"6\" \n"
+ "|- valign=\"top\" \n"
+ "| width=\"40%\" bgcolor=\"#FFF4F4\" style=\"border: solid 1px #ffc9c9; padding:1em;\" cellpadding=\"0\" cellspacing=\"0\" | \n"
+ "{| cellspacing=\"0\" cellpadding=\"0\" \n" + "| bgcolor=\"#FFF4F4\" | \n"
+ "\'\'\'jamwiki.org\'\'\' is dedicated to develop a beautiful wiki\n" + "\n" + "|} \n"
+ "| width=\"60%\" bgcolor=\"#f0f0ff\" style=\"border: 1px solid #C6C9FF; padding: 1em;\" | \n"
+ "{| cellspacing=\"0\" cellpadding=\"6\" \n" + "| bgcolor=\"#f0f0ff\" |\n" + "\n" + "|}\n" + "|}\n" + "";
public SimpleParserTests(String name)
{
super(name);
}
public void testParagraph1()
{
check("This is a simple paragraph.", "<p>This is a simple paragraph.\n" + "</p>");
}
public void testBoldItalic()
{
check("'''Hello''' ''world'' '''''HelloWorld'''''", "<p><b>Hello</b> <i>world</i> <b><i>HelloWorld</b></i>\n" + "</p>");
}
public void testHead()
{
check(
"== head 1 ==\nsome text \n=== head 2 ===",
"<div style=\"font-size:90%;float:right;margin-left:5px;\">[<a href=\"context/path/en/Special:Edit?topic=Test_Topic&section=1\">Edit</a>]</div><a name=\"head_1\"></a><h2> head 1 </h2>\n"
+ "<p>some text \n"
+ "</p><div style=\"font-size:90%;float:right;margin-left:5px;\">[<a href=\"context/path/en/Special:Edit?topic=Test_Topic&section=2\">Edit</a>]</div><a name=\"head_2\"></a><h3> head 2 </h3>\n"
+ "");
}
public void testList()
{
check("* Item 1\n" + "* Item 2", "<ul><li> Item 1\n" + "</li><li> Item 2\n" + "</li></ul>");
}
public void testTable()
{
check(
TABLE_TEST,
"<table width=\"100%\" cellspacing=\"3\" cellpadding=\"6\"><tr valign=\"top\"><td width=\"40%\" bgcolor=\"#FFF4F4\" style=\"border: solid 1px #ffc9c9; padding:1em;\" cellpadding=\"0\" cellspacing=\"0\"> \n"
+ "<table cellspacing=\"0\" cellpadding=\"0\"><td bgcolor=\"#FFF4F4\"> \n"
+ "<p><b>jamwiki.org</b> is dedicated to develop a beautiful wiki</p>\n"
+ "\n"
+ "</td></tr></table>\n"
+ " \n"
+ "</td><td width=\"60%\" bgcolor=\"#f0f0ff\" style=\"border: 1px solid #C6C9FF; padding: 1em;\"> \n"
+ "<table cellspacing=\"0\" cellpadding=\"6\"><td bgcolor=\"#f0f0ff\">\n"
+ "\n"
+ "</td></tr></table>\n"
+ "\n" + "</td></tr></table>\n" + "<p><br /></p>");
}
public void testSignature()
{
check("-- ~~~", "<p>-- [[User:dummy|displayName]]\n" + "</p>");
}
public void testPreformatedText1()
{
// this seems to be wrong:
check(" < > & \" \' test ", "<pre>< > & " ' test \n");
}
public void testPreformatedText2()
{
// this seems to be wrong:
check("<pre> < > & \" ' test </pre>", "<pre> < > & " ' test </pre>\n");
}
public void testNoWiki()
{
// this seems to be wrong:
check("<nowiki>< > & \" ' test </nowiki>", "< > & " ' test \n");
}
}
Posted by axelclk
( Aug 24 2006, 07:10:50 PM CEST )
Permalink
Comments [0]
Seems that more and more people try implementing Wikipedia functionalities in Java
JAMWiki is the newest and greatest project:
Posted by axelclk ( Aug 19 2006, 05:47:48 PM CEST ) Permalink Comments [1]Debugging JavaScript errors in GWT generated code for Firefox
The first version of my MathEclipse calculator had an error in Firefox 1.5. The application run's fine under Internet Explorer 6.0.
The error messages was:
uncaught exception: com.google.gwt.core.client.JavaScriptException: JavaScript TypeError exception: seb has no properties
As a first attempt to solve this bug I installed Firebug.
With the feature Spy on XMLHttpRequest traffic I could see, that the error occured before the RPC XMLHttpRequest was send.
In the next step I set the option -style pretty in the Calc-compile.cmd script,
so that the GWT compiler generates readable JavaScript code.
Now I could see in the Firebug debugger, that in the function _$__evaluate a serialization call for the RPC requests produces an error in the function: _$writeObject(_stream, _function).
The variable _function contained the value "eval".
After renaming the function from "eval" to "$eval" the script runs perfectly under Firefox.
This bug seems to be a problem with the "eval" keyword under Firefox as explained here:
Don't rely on IndexOutOfBoundsException in GWT
The IndexOutOfBoundsException works good in the hosted GWT mode, but the generated JavaScript code doesn't ( at least for char[] arrays).
The following pattern throws an IndexOutOfBoundsException in the hosted mode, if currentPosition isn't valid. But in the JavaScript code generated by GWT source[currentPosition++], only results in an undefined character.
public String filter(String input) {
char[] source = input.toCharArray();
int currentPosition = 0;
...
...
try {
while (true) {
currentChar = source[currentPosition++];
...
// do something here
...
}
} catch (IndexOutOfBoundsException e) {
}
Posted by axelclk
( Aug 13 2006, 11:56:14 AM CEST )
Permalink
Comments [1]
GWT 1.1.0 beta released with new I18N and XML examples
GWT 1.1.0 beta is now available with new I18N and XML examples:
There are now 2 new examples: SimpleXML and I18N available in the download.
For an overview about all new features and bug fixes open the gwt-windows-1.1.0/index.html file.
Ed Burnette prepared all GWT examples for the Eclipse IDE. See his message in the Google Web Toolkit forum.
Posted by axelclk ( Aug 12 2006, 10:25:06 AM CEST ) Permalink Comments [0]A resizable matrix form build with GWT
A simple example for a resizable matrix input form made with the GWT. If you resize the matrix the createMatrix() method will be called and destroy all values previously set in the matrix cells. So this method could probably be optimized not throwing away all values on resizing.
Any other suggestions how to improve this matrix input form for MathEclipse?
The coding is made in the style of the GWT KitchenSink example:
package org.matheclipse.gwt.client;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* Creates a resizable Matrix input
* @author Axel Kramer ( axelclk_gmail_com )
*/
public class Matrix extends Sink {
public static SinkInfo init() {
return new SinkInfo("Matrix", "Input the data of your matrix.") {
public Sink createInstance() {
return new Matrix();
}
};
}
private TextBox fRowsTextBox = new TextBox();
private TextBox fColumnsTextBox = new TextBox();
private HorizontalPanel fMatrixPanel = new HorizontalPanel();
private TextBox[][] fTextBoxArray;
private int fRows = 10;
private int fColumns = 12;
private Grid fMatrixGrid;
private TextBox fValue = new TextBox();
private final Button fDimButton = new Button("Set matrix dimensions");
private final Button fSetValueButton = new Button("Set cell value");
public Matrix() {
fDimButton.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
try {
int rows = Integer.parseInt(fRowsTextBox.getText());
int columns = Integer.parseInt(fColumnsTextBox.getText());
if (fRows > 0 && fRows <= 20 && fColumns > 0
&& fColumns <= 20) {
fRows = rows;
fColumns = columns;
createMatrix(fRows, fColumns);
}
} catch (NumberFormatException e) {
}
}
});
fSetValueButton.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
for (int i = 0; i < fRows; i++) {
for (int j = 0; j < fColumns; j++) {
fTextBoxArray[i][j].setText(fValue.getText());
}
}
}
});
fRowsTextBox.setText(Integer.toString(fRows));
fColumnsTextBox.setText(Integer.toString(fColumns));
HorizontalPanel dimensionPanel = new HorizontalPanel();
dimensionPanel.setSpacing(4);
dimensionPanel.add(new Label("Rows:"));
dimensionPanel.add(fRowsTextBox);
dimensionPanel.add(new Label("Columns:"));
dimensionPanel.add(fColumnsTextBox);
dimensionPanel.add(fDimButton);
HorizontalPanel valuePanel = new HorizontalPanel();
valuePanel.add(new Label("Cell value:"));
valuePanel.add(fValue);
valuePanel.add(fSetValueButton);
VerticalPanel verticalPanel = new VerticalPanel();
verticalPanel.setSpacing(8);
verticalPanel.add(dimensionPanel);
verticalPanel.add(valuePanel);
verticalPanel.add(fMatrixPanel);
createMatrix(fRows, fColumns);
setWidget(verticalPanel);
}
private void createMatrix(int rows, int columns) {
// clear old matrix widgets
fMatrixPanel.clear();
TextBox widget;
fTextBoxArray = new TextBox[rows][columns];
fMatrixGrid = new Grid(rows, columns);
for (int i = 0; i < rows; ++i) {
for (int j = 0; j < columns; ++j) {
widget = new TextBox();
widget.setVisibleLength(5);
fMatrixGrid.setWidget(i, j, widget);
fTextBoxArray[i][j] = widget;
}
}
fMatrixGrid.setWidth("100%");
fMatrixGrid.setBorderWidth(1);
fMatrixGrid.setCellSpacing(1);
fMatrixPanel.add(fMatrixGrid);
}
}
Posted by axelclk
( Aug 03 2006, 06:56:56 PM CEST )
Permalink
Comments [0]
AJAX sites reworked to Google Web Toolkit based pages
I reworked my AJAX based pages at:
to Google Web Toolkit(GWT) based sites. As you can see from the design, I used the GWT KitchenSink example as a basis for the implementation.
GWT has the advantage that I can use my favourite programming language (Java) to develop and test the application. If the applicaion has to be deployed to the web, I simply run the "Java to JavaScript" compiler to create the JavaScript for the website.
The MathEclipse calculator now has this new features:
The GWT code for MathEclipse can be found in the CVS module:
Any suggestions on how I can improve these GWT based GUI interfaces?
Posted by axelclk ( Jul 25 2006, 07:50:01 PM CEST ) Permalink Comments [3]iText - Eclipse plugin started
Bruno Lowaggie, creator of the iText PDF library started to write an iText Eclipse plugin. The steps for creating the intial Eclipse plugins are described in 3 articles.
At the moment the plugin only displays the metadata of a PDF file on a property page.
Making an iText plug-in for Eclipse:
New version of the Groovy Eclipse Plugin available
Version 1.0.0 is available on the download site:
http://dist.codehaus.org/groovy/distributions/update/