Wednesday, July 28, 2004

Distributed Caches

John Davies has an interesting comment on the TheServerSide with regards JavaSpaces and GigaSpaces - I'm guessing its BNP Paribas.  Would love to know more details about the "seriously sexy architectures" he's be working on.

Thursday, July 15, 2004

J2ME and my Nokia 7250i

It's been a few years since I did any mobile work (a WAP web site was the last), so I thought I'd have a go at developing a simple application for my Nokia 7250i. Nokia's forums have a lot of good stuff available for developers. For starters the device details page for the 7250i gives details on what Java technology I can access - it appears I need to develop an MIDlet (max 64Kb) that I can then download Over-the-Air (OTA)

An MIDlet appear to be very to an applet in concept. The MIDLet class can be found in the javax.microedition.midlet.* package. Once you have coded your MIDlet application, you can use the Nokia Developer's Suite to generate the .JAR and .JAD (Java Application Description) files. The Nokia Developer's Suite also has an emulator which avoid round-tripping to a real phone. One issue I found with the Nokia Developer's Suite is that it comes with integrationg for Java Forte and JBuilder, but no integration for Eclipse.

The easiest way to get the MIDlet onto your phone is to place the .JAR and .JAD onto a web server, setup MIME tags for .jad and .jar, add a HTML page that links to the .JAD files, and use the Nokia phone to browse to the page, and install the application.

midlet.org and other sites on the web have a load of free applications that you can download.

J2ME code for "Hello World":
package com.First;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class First extends MIDlet
{
private MyCanvas canvas;

class MyCanvas extends Canvas
{
protected void paint(Graphics arg0) {
arg0.drawString("Hello World", 0, 0, Graphics.TOP|Graphics.LEFT);

}
}

public First()
{
canvas = new MyCanvas();
}

protected void startApp( ) throws MIDletStateChangeException
{
Display.getDisplay(this).setCurrent(canvas);
}

protected void pauseApp( )
{
}

protected void destroyApp( boolean p1 ) throws MIDletStateChangeException
{
}
}

.JAD file for the above application:
MIDlet-Name: MyMIDlet
MIDlet-Version: 0.0.1
MIDlet-Vendor: MyCompany
MicroEdition-Profile: MIDP-1.0
MicroEdition-Configuration: CLDC-1.0
MIDlet-Jar-URL: MyMIDlet.jar
MIDlet-Jar-Size: 2301
MIDlet-1: First, , com.First

Wednesday, July 14, 2004

Eclipse Rich Client Platform

Given that the client is back, the concept of using Eclipse as a rich client platform offers some interesting ideas. I know of a few development teams within tier-1 banks that are considering this Eclipse approach to consolidate exiting Java Swing rich client applications - at least SWT looks a lot better than Swing (a Swing application never looks quite right, irrespective of the hours/days spent on it).

Typesafe Enum etc - Pre Java 5.0

Here are a few comments having jumped back onto the Java bandwagon after spending the last 15 months using Microsoft .NET:


  • Move from C# which has enum's to Java which doesn't is a real pain, even Bloch's Typesafe Enum pattern doesn't help in the context of switch statements. I'm amazed Sun never added enums prior to 5.0.

  • Events in C# are far easier than in Java. Maybe Sun can fix this in Java 5.1

  • Eclipse is a really nice IDE these days. The debugging experience is finally enjoyable. There is even a plugin for ClearCase

  • The Java class library is much richer than C# with regards to collections.

Saturday, July 10, 2004

Bruce Eckel

TheServerSide had a link to Bruce's latest blog entry. The video is worth watching, since he makes some very valid points - I have to agree that the classpath is a nightmare. He also talks about Java vs .NET, and J2SE 5.0.

Friday, July 09, 2004

Garbage Collection

Nice article on tuning the garbage collection for a real application. It occurred to me today that tuning the Java GC appear to be more of a black art than tuning the Microsoft CLR GC.

DTrace appears to be getting a lot of press. There is a Flash demo of DTrace available here. Nice to see Bryan and Adam are blogging.

GregorianCalendar and Foreign Exchange

Calendars are esential in trading systems. For Foreign Exchange (FX) system in particular, calendars are very important since if a trader is executing an FX currency pair GBP/USD trade, they'll need to know the date of Spot (http://www.fx-forex-trading.com/glossary.htm#S) and other relevant tenors; Spot Next, Spot Week, x Day, x Week, x Month, x Year. Examples of tenors in short hand form are: 1W 3W 3M 1Y.

So what does the above have to do with java.util.GregorianCalendar? Well actually a lot. Since to work out spot for a currency pair, you first need to figure out what the first business day is after the transaction day - the day the trade was executed. A business day is not a weekend, and not a holiday, so for GBP/USD, we need to look at the holidays in both calendars. Assuming today is 9th July 2004, then the next business day would be 12th July 2004, which means that spot will be 13th July 2004 (assuming settlement within 2 business days of the transaction date).

A description of FX value dates can be found here.

GregorianCalendar and Foreign Exchange

Calendars are esential in trading systems. For Foreign Exchange (FX) system in particular, calendars are very important since if a trader is executing an FX currency pair GBP/USD trade, they'll need to know the date of Spot and other relevant tenors; Spot Next, Spot Week, x Day, x Week, x Month, x Year. Examples of tenors in short hand form are: 1W 3W 3M 1Y.

So what does the above have to do with java.util.GregorianCalendar? Well actually a lot. Since to work out spot for a currency pair, you first need to figure out what the first business day is after the transaction day - the day the trade was executed. A business day is not a weekend, and not a holiday, so for GBP/USD, we need to look at the holidays in both calendars. Assuming today is 9th July 2004, then the next business day would be 12th July 2004, which means that spot will be 13th July 2004 (assuming settlement within 2 business days of the transaction date).

Sunday, July 04, 2004

EJB 3.0

I have to agree with the list of common complains in this article, especially the 4 files per EJB - at least XDoclet makes life easier today. It's nice to see that Spring and other light weight containers are going to have an influence on EJB 3.0. Hopefully EJB 3.0 will be heavily influence Java 5.0 Metadata

Friday, July 02, 2004

Java Corba

It’s been a while since I did any CORBA work - that last time was probably back in the late 90's with the Iona product. So what am I doing with CORBA? I'm re-architecting a few C++ Solaris applications that use the Versant database. The replacement servers will use Java 1.4 and an Oracle database. Its kind of strange to read the legacy code, with the TIE and narrow().