Sunday, November 04, 2007

Dear iPod Touch...

Dear iPod Touch,

We've know each other only a few weeks now and I thought I'd write and tell you how I feel. I must say I really love your interface, and the way you seem to be just the right size and weight. I also love some of your little idiosyncracies like the fact you understand enough to stop whenever I pull out your earphones, and oh! your glorious flick scrolling and pinch resizing. That really touches [sic] me.

(It's in fact so sweet that I'll forgive you making me scroll for hours and hours to find 'United Kingdom' in the countries list on (badly designed) website registration pages... oh, and the fact that your cousin; 'Old Shuffle' herself, had a really handy play/pause button always there when someone interrupted us while we were in full swing... and then there was that night when the clocks changed and you got so high on your own moonshine heaven knows what time you thought it was until my laptop reminded you. But no matter, nobody's perfect)

But it's not all sweetness and light. Why oh why can't I have Flash in your browser? And why can I only access paid for content with your iTunes and not also my lovely free podcasts? (your evil nemesis Zune can do just that by the way) And when will I get access to the lovely mobile gmail that others waxlyrical about? But most of all why wasn't your SDK published from the very beginning? I feel like you're holding back on me.

I must admit that I was eleated when you showed me Remember the Milk's lovely ode to you (even better than Facebook's but don't let them know that) but your browser doesn't support Google Gears yet so I can't go offline; and that, to be honest is my real problem with you. Where we now live (the UK), ubiquitous and free internet is just a little bit too far away to make you the rounded package I thought you would be when we started this relationship.

Perhaps, yes, it was the crazy insanity of that night in New York when we first met that made me forget there were such practical issues to consider. But I, in my crazy, over optimistic way thought we'd soldier on, and perhaps we can. But it'll be on slightly different terms. I'm home now and despite what you melodiously sing to me each day, we aren't in Silicon Valley any more and we're going to have to wait for the full power of the new age to reach us over here. I'm hoping we can have good fun doing it. Lets try shall we?

Thursday, September 20, 2007

WAS 6.0 - Setting PMI Logging Levels and JVM args with Jython

As previously mentioned, I'm in the process of getting ready for some NFR testing. The plan is that we will make some pretty heavy use of the PMI infrastructure in WebSphere Application Server 6.0.x. There is a bunch of information that it can let us have, I just don't want all of it. Neither do I want to have to manually log in to all of my servers and tick all the little boxes in the UI. Much nicer to have a Jython script to do it automagically (i.e. set my logging level to "CUSTOM", enable the modules I need, add the JVM arg for additional info and switch on the whole shebang)....:

Tip: Figure out your settings manually, then run the script up to the bit where it pumps out your current config (comment out the rest). Then copy and paste this output into your script. Then uncomment and run again against all the other servers you're wanting to configure.

Wednesday, September 19, 2007

Using Jython to Start and Stop TPV Logging in WAS 6.0

I'm trying to automate some WAS 6.0 logging for a bout of NFR testnig which is coming my way soon. The plan is that we will use PMI to get all the info we need and use the Tivoli Performance Viewer Logging functionality to save this to file so that we can view it out leisure after the fact. It might have been acceptable to start and stop logging manually if we were able to get access to the Web Admin Console but unfortunately this is off limits to us. I've had to write the following Jython scripts instead.

Start Logging:

Stop Logging:

Note: These scripts were a bit of a nigthmare to write because of the almost complete lack of documentation of the TivoliPerfEngine MBean. However some checking of the xml config files which WAS uses, some cross referencing with the manual UI version of the same steps, and a good dose of trial and error finally bore fruit. I should thank two of my collegues (you know who you are) who helped me with some pointers when I got stuck.

Wednesday, September 12, 2007

When did Netbeans 6 go Beta?

I usually pride myself on being pretty up on the latest builds of Netbeans. However it seems that the latest release passed me by. A colleague asked me if I had the latest Beta of 6.0. "Nope" I said and checked the site. Wherever I looked I could only see the latest Milestone (currently 10) but no beta. Then he showed me this link. Does this mean 6.0 went beta silently? Did I miss the announcement? What's up guys? Loving the new pastille icon though...

Friday, August 17, 2007


Why can't the Blogger compose tool realise when I've cut and pasted some html / xml / "something technical with characters html needs escaping" and
just escape them for me? Please?

CSS two and three column layout without absolute positioning (for IE, Firefox and Safari)

We all know it's best practice to use divs for HTML layout over tables and there's loads of examples out there of how to do it. The problem all the ones I found used absolute positioning or fixed width columns. I wanted to see if I could do it (or get close to it) without making these compromises. Here are the results.

Two Column Layout

Admittedly there are a few problems with this. When you resize the window below a certain size columns will jump into the left hand side of the screen. Not entirely like a table. Also the % widths cannot add up totally to 100%. I don't really understand why.

Also, please note that in this two column layout, you can only have one nav column plus the middle column on a page. If you have all three, the layout breaks. If you want both a left and right hand side nav column layout (i.e. a three column layout), you need to change the % widths to something like 25%, 40% and 25% respectively.

Table Layout Substitute
Finally, here's some CSS to use to replace tables when you've used them for things like laying out froms:

and here's an example of the 2 column layout plus the table substitute in use:

Again, there are a few problems, mainly around the content sometimes spilling when the windows are tool small but it works pretty well.

If you doubt this works, here are some screenshots of it on Firefox, IE 6.0 and Safari (all on Windows XP).

Thursday, July 26, 2007

grubby - a quick and dirty data generation tool

Over the past few weeks I've been open sourcing code from the last few projects I've worked on. It's firstly a set of classes providing random generation utilities plus some handy utility methods. These are available in a 0.1 release from the project website and you can use them now.

Building upon this, next I'll be working on a set of "data beans". The idea is that these will be simple POJO representations of a row in a database or a CSV file, capable of toString'ing themselves to CSV or a SQL insert statement and stored in collections which are self iterating (think ruby). If this sounds like your common or garden data model beans with a little extra functionality, you'd be right. Ideally, this component can leverage a from-schema generation tools based upon EJB 3.0/JPA 1.0 (such as Netbeans) so you don't have to write these yourself. These can be edited so they extend the grubby data beans abstract classes which provides the extra grubby functionality. To use, all you need to do is generate your beans, fill them with random data using the aforementioned generation utilities and then get them to toString themselves to the data upload file type of your choice - SQL or CSV.

Beyond this I plan to create a set of annotations to use so you can simplify the definition of the allowed values for an attribute and also specify the relationships between beans with ease. In addition, there will be a config engine so users can specify where input and output files are located and a set of common builders to reduce the need to implement some common elements entirely (e.g. Addresses).

So, if it sounds like this is something you might find useful, please go to the site and take a look. If you want the javadoc and other information, checkout the project source and generate the maven site (run the "maven site" goal). If you want to help, check out the code and have a look. If you have some comments, suggested changes or a patch, send me a mail. Enjoy.

Wednesday, July 18, 2007

Setting Trace Logging Levels in WAS 6.0 with JACL

I've recently had to change the trace logging levels in a WAS instance without the aid of the web UI. Here is the wsadmin JACL script which I used to do it:
# NOTE: Edit the following two variables for your environment
# They can be discerned from the path to your instance's bin directory
# The following shows the deployment manager ("dmgr") in the "myCell" node
set node myCell
set server dmgr

# Get up the variables required by the rest of the script
set svr [$AdminConfig getid /Node:$node/Server:$server/]
set ts [$AdminConfig list TraceService $svr]

# Modify the trace settings
# NOTE: Edit this settings string to reflect the settings you require
$AdminConfig modify $ts {{startupTraceSpecification *=warning=enabled:SystemErr=all=enabled}}

# Make the changes permanent
$AdminConfig save
To run it just save it as a file called set_trace_levels.jacl and run with the command:
./ -port [SOAP port] -user [myWASAdminUID] -password [myPassword] -f set_trace_levels.jacl
NOTE: If you're on Windows, change "" to "wsadmin.bat"

Thursday, July 12, 2007

Overheard in I.T: "I am not a Number!"

Consultant #1: "We're a team. But we're a team of ... individuals..."
Consultant #2: ?!?!

-- Wardour Street, Soho, London

Apologies to Overheard in New York

Friday, June 01, 2007

Notes from JavaOne 2007 - The Semantic Web (BOF-6746)

This post is a tidied up version of the notes I took at Henry Story's BOF (BOF-6746) at the 2007 JavaOne variously entitled "Web 3.0: This is the Semantic Web" or "Developing Web 3.0". They are best read alongside the presentation. Henry moves fast...

"PC era" - "The Desktop" (1980 - 1990)
"Web 1.0" - "The World Wide Web" (1990 - 2000)
"Web 2.0" - "The Social Web" (2000 - 2010)
"Web 3.0" - "The Data Web" -> "The Semantic Web" (2010 - 2020)
"Web 4.0" - "The NetOS" -> "The Intelligent Web" (2020 - 2030)

[DEMO] "Web 2.7" - Freebase. This is a Semantic wiki. It is all structured data. You can create classes of things. If I create a new film it will create a new film object and the information about it. I can also create my own classes. I am creating a database on the web

Pic: "It's Dog Simple - It's not complicated. Reality is complicated."

Web Architecture 101
  • URI (encompasses URLs and URNs) - "Universal Resource Identifier". This identifies a Resource. You might as well use URIs as they are
  • REST - "Representational State Transfer". A URL in a web browser can do an HTTP "GET" and a Representation of the Resource mapped by the URL is returned. A resource can return any number of representations.
  • Caching - The Web can cache Representations. If I call the same URL I get the same result.
  • Relations - REST consists of relations. RDBMS has limitations: relations are local, not universal. We want to webify the DB. If you add URIs to the Subject (e.g. "Tim"), Relation (e.g. the column name - "Name") and the Object (e.g. the row id'd by the Primary Key) we can get an Object with a "GET". You simply click on the URL to get it's meaning. Relations are now universal
  • RDF - "Resource Description Framework" - URI's exist to define Subjects , Relations/Properties and Objects
  • RDF with namespaces - Simplifies the URI's with @prefix. E.g. @refix foaf:
  • Syntax (how the URI strings combine to identify Objects) versus Semantics (how URI strings relate to the world - what they map to)
Advantages - Simplicity.
  • URIs are the only way to identify resources worldwide.
  • REST is the most scalable and simplest way to set up a universal info space.
  • RDF - you can't do it with less than a triple (Subject, Relation/Property, Object), it has syntax independence and is clickable (i.e. click the link) data
FOAF is a simple ontology to describe friend of a friend relationships (Available today on blogs) - it is an example of a semantic dataset

Another way to write down RDF data

Ontology Web Language - a set of resources which define things like classes, properties, the set of relations required to do something with an object in programming

Description of a project (another ontology - we can use classes from different libraries. It is all in one uniform information space). This is being used today to describe OSS projects. Once informarion is explsed in this format it can be scraped and aggregated

There are ~500 Semantic tools, 50% in Java
  • DOAP integration with Netbeans
  • Protege - lets you define ontologies
  • TopBraid Composer - define ontologies and instance data
  • @RDF annotations in Java - there is a project
  • Baetle - Bug And Defect Tracking Language
    • Uses - once you can track bug info from all OSS projects you can create bug hierarchies (e.g. "this bug from NB depends on this bug from Apache")
  • SPARQL - Semantic web query language. This is being stabdardised in the W3C. It looks a lot like SQL. If you have RDF data srored in a repository, you can then put a SPARQL endpoint in front of that. The data comes back as lists of RDF triples. You can query > 1 repository and then compare all the results by URI - the same URI means it is the same item. Therefore you don't need to refactor multiple databases together. You can get results back as simple XML(JSON)
  • RDF databases - The right way to do it is to publish data at URLs. You link all this information to see what new information you can get. To be meaningful, you need to know where the individual pieces of data came from to allow preferences of different data resources. "Reasoning". You can publish RDF onto a web page. Or you can publish it in an RDF database. There is a new class of DB to store this - "Triple Stores". These are more optimised for big lists of triples than an RDBMS
  • Semantic Wiki
  • Semantic Desktop - if all your data is all over your desktop and your web, the only way to keep track of this is to use URLs
Read More

Monday, May 28, 2007

Notes from the FindBugs BOF9231 at JavaOne 2007

NOTE: These are my incomplete notes from the FindBugs BOF at JavaOne 2007. I got in late due to the crush outside so missed the start of the session.

The latest release has some new(ish) features:
  • Annotations for @NotNull, @CheckForNull, @CheckReturnValue
  • JSR 305 (Annotations for Software Defect Detection) will standardise these annotations so that they can be used in multiple tools.
  • They will be released in a javax package
  • The EG has a google group for discussions and there is already unofficial output: annotated versions of standard libraries.
Using Findbugs to Compute a Bug's History
  • Findbugs can keep track of when a bug was introduced and when it was resolved. This is recorded in histotical data (xml format)
  • Bugs can be audted by a user and annotated in the history (e.g. must fix, not bug, etc. plus a free text area for more notes)
  • This functionality is integrated with various IDEs. (IDEA, Eclipse, Netbeans)
Ways to Use FindBugs
  • Command Line Interface
  • FindBugs Tool (a Swing UI)
  • Ant
  • Maven
  • Other IDEs
Using Findbugs Well
  • Run it every night or at least every build
  • The results of audits should be remembered (i.e. once a bug is marked, don't forget it)
  • You should be able to identify which bugs are new in the build and which have been there since the last release
  • You should be able to identify bug patterns which are of concern to your project
  • Google are using it and have a paper (which I can't find at the moment) describing their experiences and how to incorporate it into a production development environment
Future of the Project
  • There are currently 1.3 developers (as of the BOF)
  • There is a need to build a better OSS community
  • The "documentation sucks"
  • Mailing Lists
    • findbugs-announce
    • findbugs-discuss
    • findbugs-core
  • There is also a google group
Update - It seems as if FundBugs may be moving to GoogleCode for its hosting

JavaOne 2007 - Closures for the Java Language - TS-2294 and BOF-2358 Notes

NOTE: This is an aggregation of the notes I took from Neal Gafter's two sessions at JavaOne 2007 on his Closures for the Java Language proposal.

"Why add closures? Isn't Java complicated enough already?"
“ In another thirty years people will laugh at anyone who tries to invent a language without closures, just as they'll laugh now at anyone who tries to invent a language without recursion.” — Mark Jason Dominus

Goals of the Closures Spec Proposal
  • Provide concise "function" literals - without the pain of anonymous instances (i.e. anonymous inner classes)
  • Interoperate with existing APIs (esp. java.util Collections)
  • Solve problems which Anonymous Inner Classes can't - simplify
  • Enable control APIs (c.f. Scala, Ruby)
  • Wrapped code not changed
  • Function and aggregate operations
  • Write methods which act like new keywords (but only act like)
  • Simple but powerful
  • A "closure" is a function which refers to free variables in its lexical context where a "function" is a block of code with parameters that may produce a result value.
  • A "free variable" is an identifier used but not defined by the closure.
  • "Control APIs" are API specific statement forms on a par with built in statements, like special methods.
Problems with anonymous instances
  • Verbose, extra wordy, clumsy, redundant - whereas closures are concise
  • They incompletely capture the lexical context - i.e. "this" and "toString( )" don't refer to what they ought; return, break and continue operate differently also, and you cannot use non final local variables
  • Consequently they force irrelevant refactoring
  • Control APIs are not possible - You cannot wrap arbitrary blocks of code
Syntax - Closure Expressions
{int x => x+1}
{int x, int y => x+y}
{String x => Integer.parseInt(x)}
{=> System.out.println(“hello”);}
{ FormalParameterDecls opt => BlockStatements opt Expression opt }
  • Creates an object which represents code of the body and the lexical context
  • Few restrictions - may access local variables and this and may return from the enclosing method
The closure conversion turns a closure into an instance of some interface
  • This provides interoperability with existing APIS
  • Means you can restrict the closures operations (but you must do this explicitly. It is not done for you by default)
  • If there is not target type, it will use the natural function type
Syntax - Function Types
{int => int}
{int, int => int}
{String => int throws NumberFormatException}
{ => void}
{T => U}
{TypeList opt => Type FunctionThrows opt }

{String => int throws NumberFormatException} is shorthand for java.lang.function.IO where
package java.lang.function;
public interface IO {
int invoke(A a0) throws X;
  • Function types are "ordinary" interface types with an invoke method
  • You can extend and implement them
  • They can declare variables, parameters, return types etc.
  • (There are no special type rules)
Syntax - Control Statements
withLock(lock, {=>
withLock(lock) {
for opt Primary ( Formals : ExpressionList opt ) Statement
for opt Primary ( ExpressionList opt ) Statement

Is translated to:
Primary( ExpressionList, { Formals => Statement });

1. Control APIs - Perform some operation while holding a java.util.concurrent.Lock
(a) Today:
void incrementBalance(int deposit) {
try {
balance += deposit;
} finally {
(b) Using a proposed new closure-based API:
void incrementBalance(int deposit) {
{ => balance += deposit; });
(c) Using the control statement syntax:
void incrementBalance(int deposit) {
Locks.withLock(myLock) {
balance += deposit;
2. Aggregate Operations - Make a new list by applying a function to each element of an existing list:
List parseInts(List strings)
throws NumberFormatException {
strings, {String s => Integer.decode(s)});
3. Interaction with existing APIs - launch a task using an executor
(a) Today:
void launch(Executor ex) {
ex.execute(new Runnable() {
public void run() {
(b) Useing a closure:
void launch(Executor ex) {
ex.execute({ =>
(c) Using the control statement syntax:
void launch(Executor ex) {
ex.execute() {
3. Interaction with existing APIs - Add a Swing listener
(a) Today:
void addListener(final ItemSelectable is) {
new ItemListener() {
public void itemStateChanged(ItemEvent e)
{ doSomething(e, is); }
(b) Using a closure:
void addListener(final ItemSelectable is) {
{ ItemEvent e => doSomething(e, is); }
(c) Using the control statement syntax:
void addListener(final ItemSelectable is) {
is.addItemListener(ItemEvent e :) {
doSomething(e, is);
New APIs
  • API specific control constructs - Collections (e.g. Map Specific iteration), concurrency (e.g. locking) and closables (e.g. resource streams closed automatically at the end of a block)
  • Aggregate operations. E.g.:
List list = …;
Integer sum = Collections.reduce(
{Integer x, Integer y => x+y});
  • Functional primitives

Questions from the Audience
"How do you deal with the namespace issue?"
  • A closure is a method name therefore you have your own scope
  • Use an import statement - a closure is just an API method
"Have you thought of restricting the use of closures? i.e. a member variable which is a closure which extends a generic"
  • No, no one can determine what is and what isn't useful. Just because you can't think of a use case, doesn't mean someone else won't. The only reason you would do something is because you need to.
  • The proposal includes ways for all API writers to restrict how closures are used with them, but blanket restrictions would be trouble.
"How do closures get executed?"
  • The closure expression has parameter types, a return type, and types it uses within it. The compiler analyses this but does not go and impose this on the closure.
  • It works like overloader resolution - it picks which is most specific, therefore there is no type inference but there is a compatability rule.
"How do I pass multiple parameters?"
  • You don't need to. Everything outside the closure can be accessed from within the closure.
"How do we evaluate whether we should add 'this'? - and will it make Java simpler?"
  • It will make it easier to write and read. ("I'm hoping for a video with a Star Wars theme to help me decide") Java today is not the easy Java we had in 1999
Where Can I Read / Hear More?

Saturday, May 26, 2007

RESTful Web Services: JSR-311 (TS-6411) at JavaOne 2007

These are the notes which I took during the RESTful Web Services Technical Session at JavaOne 2007. Eventually the presentation audio will be available but until then this should provide a good overview of what was said.

Speakers: Paul Sandoz, Marc Hadley, Peter Liu

"REST" is the architectural style of the WWW. Note that "style" is not "architecture". Coined by Roy Fielding in his PhD thesis.

- These can be considered as the Platonic ideal forms. They are identified by "Uniform Resource Identifiers" ( aka "URIs") and realised by "Representations" which are the equivalent of the shadows in our Platonic Cave metaphor.

Methods - Methods are how we interact with the resources. In the HTTP paradigm these are as you would expect GET, POST, etc. The key is that they are a small set and fixed for all resources. They facilitate the exchange of the representations.

Representations - Representations embody the state of a resouce r at time t. Therefore,you can see that there can be multiple, alternate representations of a given single resource R. It can be conceived of as a finite state machine.

Few endpoints. Few nouns but many verbs e.g.:
Many resources, few fixed methods. Many nouns and few verbs e.g.:
GET /music/artist/my_artist/recordings
REST allows you to cache because caches can understand the semantics in the protocol. These are not embedded in the message as they are in RPC.

HTTP is an application protocol. RESTful web services are "of the web". Don't hide / ignore elements in the network which help you - e.g. caches.

Why a Java REST API?
Lots of companies now offer them (Google, Amazon, eBay, etc.) to expose their services. Where both WS-* and REST APIs are offered, REST are more widely used. It is proposed that this is due to their simplicity (they are easy to consume with common web scripting scripting languages such as PHP) and ability to use web browsers for testing.

The current Java web APIs (e.g. the Servlet API) are too low level though they can be used to implement a REST Web Service. There are many opportunities to simplify development as there must be a better way:
  • High level
  • Declarative
  • Clearly maps to REST concepts
  • Takes care of the boilerplate code
  • Makes it easy to do the right thing
  • Provides a graceful fallback to a lower level API when it's needed
API Elements
Java doesn't really have a concept of a Representation or a Resource. If we try and code a REST servlet without the API we see that we would need to implement content negotiation (what form the Representation should take e.g. xml, text, etc.) and path parsing ( e.g. what Resource(s) have been requested ).

Automate Content Negotiation
Declare what content will be returned:
protected void doGet(HttpServletREquest request,
HttpServletResponse response)
URI Templates
Declare what method responds to which requests:
@URITemplate("/artists/{id}") public class Artist extends HttpServlet { ...
This means your container should only call this servlet when requests match this template. To take this one step farther we can combine and apply these annotations to a POJO:
public class Artist { @HttpMethod // Needed as we no longer implement HttpServlet InputStream getXml(@URIParam("id") String artist) { ... } @ProduceMime("application/json") @HttpMethod // Needed as we no longer implement HttpServlet InputStream getJson(@URIParam("id") String artist) { ... } @HttpMethod @UriTemplate("recordings") InputStream getRecordingsXml(@UriParam("id") String artist) { ... }
Declaring Resource Class Methods
@HttpMethod - The method name can then be anything with the default HTTP methods being taken from the annotated java method name. E.g:
@HttpMethod public XXX getXXX( ) { ... } @HttpMethod("GET") public XXX find( ) { ... }
Method Return Types HttpResponse - provide specialised subclasses for common types of response such as Redirect, Resource Creation, etc.

Representation - provide control of entity related headers such as media type, language, etc.

T - when a default media type can be determined. This is extensible via the SPI.
public Recording getRecording( )
Method Parameters
There may be multiple annotated with @URIParam, @QueryParam, @MatrixParam, @HeaderParam (flexible typing) plus zero or one of type Entity or T. E.g.:
public Recording updateRecording(
@URIParam("id") String id, Recording updatedRecording)
Deployment Options
  • Servlet and Java APIs for XML web service (JAX-WS) providers will be required by the JSR
  • The Sun Reference Implementation will also add support for Grizzly and the Java SE 6 lightweight HTTP server
  • Restlet support expected - for fall back if needed
  • SPI for other containers
  • Annotations vs. Classes and Interfaces?
    • Annotations are good for static information
    • Classes and Information are good for dynamic information
    • When to use? It is nice to replace a lot of logic with a nice annotation
  • Resource Lifecycle?
    • Per request, per session or singleton?
  • Container or API - what should go where?
    • Security
    • Filters / Guards
  • Other language support
    • Annotation support is difficult in JavaScript and Ruby
    • Low level APIs start to lose the benefits
  • High-level declarative programming model
  • REST concepts reflected in the API
  • Flexible typing, runtime takes care of common conversions
  • SPIs to extend capabilities
  • Pluggable support for types, containers, and resolvers
  • Flexible deployment options

Monday, May 21, 2007

JRuby on Rails - Agility for the Enterprise (TS-9370 at JavaOne 2007)

These are the notes I took on Charles and Toms talk at the 2007 JavaOne conference. The slides are also available and I'll link to the presentation when its up too, though for now, you have to put up with this...

"See how the other 8% lives"
Ruby is gaining in popularity and developer mindshare. This is largely due to the killer app that is Ruby on Rails (or "RoR"). JRuby is a Java implementation of the Ruby Interpreter (commonly referred to as "Matz's Ruby Interpreter" or MRI after its creator). Because Rails is written in Ruby, it is possible to run Rails apps on JRuby. Charles Nutter and Thomas Enebo have come to talk about it.

Charles started off life as a Java EE architect. Tom was a web app architect. Now they are both working on JRuby after having been hired by Sun. The aim is for it to become a first class language citizen on the JVM.

"What is Ruby?"
  • It's a dynamically typed language
  • It's fully object oriented
  • It is designed to be simple, productive and fun to use
  • It is interpreted (rather than compiled)
  • The original interpreter, MRI, is written in C (and is sometimes referred to as "CRuby" by the JRuby crowd
  • The implementation (which is open source) is the only specification (though this may change)
  • It was created to be "more powerful than Perl and more OO than Python"
Pure OO
7.class => Fixnum
There is also sweet syntactic sugar for literals:
  • For regex
  • Literal arrays on 1 line
  • Associative arrays / hashes
  • Strings: "foo"
Dynamically Typed
Ruby doesn't care about an Objects type, only about the operations which it can perform. Consequently it throws "no method error" runtime exceptions.

Ruby only has single inheritance. However it also includes Modules (also called "Mixins") which you can include in your classes to provide additional functionality. They are a mix between Java's Interfaces and Abstract Classes.

Blocks (which are also referred to as "closures" in other languages) are methods that you can pass around your code and invoke when you want to. This invokation is on the end of the method call and means that you can remove repetitive code and defer things such as the logic of iteration to collections themselves, allowing them to call out to the block for the processing logic at each step.

They also allow you to internalise transaction code. E.g. { | file | line = file.gets }
In this example the file is autoamtically closed. You need not worry about this as a programmer.

It is for these reasons that closures are under consideration for inclusion in the Java language.

Meta Programming
In Ruby Classes and Modules are always open. This means that you can dynamically include them at any point. You can also provide dispatch methods such as method_missing which intercepts and safely handles calls to non existent methods. There is an equivalent const_missing variable.

"What is JRuby?"
The JRuby project was started in 2002 and is a Pure Java, open source implementation of MRI. It is aiming for full compatability with the current Ruby (v. 1.8). This compatability is the primary focus, over performance.

It integrates with Java via the Bean Scripting Framework, JSR-223 and Spring. It is supported by a growing set of external projects such as Goldspike and ActiveRecord-JDBC.

"Why JRuby over Ruby?"
  • Soon it will be faster (the team are working on a compiler so you can run your Ruby applications as JVM bytecode)
  • Scales better (it uses native threads whereas CRuby uses green threads)
  • Native unicode support (CRuby is working on this now, JRuby leverages Java)
  • Integration with the Java libraries (include "java")
  • Easier path into the enterprise - how? See below...
"Why JRuby over Java?"
  • Language features available now (blocks, modules, metaprogramming)
  • Ruby applications / libraries (Rails, RSpec, Rake, Raven, etc)
Ruby on Rails
Rails is a full stack MVC framework written in Ruby which is open sourced under the MIT licence. It was released in 2004 and was written by David Heinemeier Hansson. RoR books already outsell those on Perl. It has a single threaded, share-nothing architecture and ships with MacOS X Leopard.

Rails Precepts
  • Convention over configuration - Based on the philosophy of "why punish the common cases?" this encourges standard practices by making them as simple as possible. In many cases, there is nothing for the developer to do at all. This makes everything simpler and smaller
  • Don't Repeat Yourself ("DRY") - Everything in RoR is written with the minimum of repetition. Repeated code is hard to adapt, maintain and less agile
  • Agility - RoR apps run from the forst command you type. There is no configuration of your environment. This allows for true iterative development from the very beginning. You can show what you do and see your changes live
"Why use Rails?"
  • Greatly Simplified - There is a lot less code in a Rails app than a comparable Java Web App
  • Instant Applications
  • Growing and excited community
  • Small applications are trivial to create
  • Excellent language
"Why use JRuby on Rails?"
  • You can deploy to Java Application Servers as a self contained WAR (using Goldspike)
  • These java web containers environments are already pervasive - it is easier for an enterprise to switch their MVC framework than a whole deployment architecture. Therefore the barrier to entry is reduced
  • Broader, more scalable database support (with ActiveRecord-JDBC)
  • Integration with Java libraries and legacy services - leverage your existing APIs and services
Rails Project Layout
Each Rails project has the same layout (Convention over Configuration at work).
controller - the "C" of MVC
helpers - DRY extracted code from the other app elements
model - the "M" of MVC
views - the "V" of MVC
config - config files
db - db config and migrations files
lib - libraries
public - static html content
test - unit tests
You put your code in the controllers and views. There is no need to wire everything up unlike in Struts or JSF.

Rails Tools - CLI
# rails myapp - Creates a rails app with the above structure called "myapp"
# ruby script/generate - Generates the MVC, migrations and scaffolding etc for your rails app
  • ActiveRecord - "ORM on steroids"
  • ActivePack - View/Controller
  • ActiveWebServer
  • ActiveMail - Mail support
  • ActiveSupport
The Demo
NOTE: What follows are my notes from the demo of pertinent points made. No attempt is made to convey the content of the demo as a whole)
  • We are running in Rails development mode
  • "Migration" - This is a DB agnostic way to specify a DDL in Ruby. They are versioned and allow for a replayable record of DB schema changes (hence "migration"). This allows a developer to save these to VCS and in the future set up the DB to a specific schema version
  • Rake is like make/ant but written in Ruby. It's not just for Ruby
  • # rake db:migrate - generate a schema on your DB for the migration chosen
  • Scaffolding - allows you to be up and running quickly. It generates the simple MVC components for an entity
  • Deployment to a Java Application Server (e.g. Glassfish)
    • Use goldspike to create a WAR file automatically which contains my application and all the libaries (Ruby and Java) which I need to run my Rails app.
    • war.rb is the config file
    • Library dependencies are drawn from maven
    • # RAILSENV=PRODUCTION rake db : migration - Change to production mode
    • # rake war : standalone : create - WAR up your app. This is all you need to deploy
"Why Run on Glassfish?"
  • Multithreading - when you run Rails in an application server extra JRuby servers spin up as you need them. In CRuby you need a "pack" of single threaded Mongrel web servers.
  • Pool DB connections (there is no DB connection pooling on CRuby Rails)
  • Access any JNDI API resource from your Rails app
  • Access any JPA datasource
  • Therefore this is a new way to do the front end of your Java EE application
  • Rubify the JEE platform APIs
  • Port the Ruby native libraries (some Ruby libraries are partially or wholly written in C and cannot be used with JRuby)
  • Mingle from Thoughtworks - Software tool to manage agile IT projects written totally in JRuby
  • ActiveJPA and ActiveHibernate

Sunday, May 20, 2007

JavaOne Bred Over-Enthusiasm...

I want to build and fiddle with Wonderland, and my own JDK! The problem is my graphics card sucks (I need acceleration) and I'm running XP (I need Feisty)...


Perhaps I'll just have to write an app in JavaFX instead...


Tuesday, May 15, 2007

Dynamic Languages in the JVM - Discussion Notes from the CommunityOne RedMonk Unconference

Discussion led by Charles Nutter, Tom Enebo, Ola Bini and Jim Rose who is leading the JSR to update the JVM instruction set to enable them to work better (JSR-292).

Conversation went onto whether dynamic languages on the JVM are needed (asked by an IBM representative) The overwhelming consensus was “yes”. It seemed to me that he / IBM don't think this dynamic thing was as important as the rest of the room. That could however just be my interpretation. People chipped in to say that while the majority of their development is pure Java at the moment, this is changing from the edges in some places or in greenfield sites. The fact that some alternate VM languages are less performant (ie. JRuby) is less important at the moment than the fact that to your IT Ops guys it looks like any other java app – in the case of JRuby, just a war. This is big. Deployment is important. If I can run it on what I have then that lowers the barrier to entry. That point was made very strongly.

Then discussion went on to calling Java resources from non-Java, JVM based languages. This is where the JCP can play the group agreed. However the JCP should not try and crash in on the language communities themselves. Charles stressed that they were not doing this with Ruby – in the same way they have a v. good relationship with Matz and are helping with input to Ruby 2.0. They plan is for JRuby to be an alternative Ruby VM like any other. The same is true of the Jython community and others. Discussion then circled around whether the JCP should come up with a plan for how these many languages should interoperate. The answer was a definite “no”. That would be bad all agreed. A Scala developer from Circle Share said that it is the community members from each language who should do that. The JVM (as designed by the JCP) should should however help support the languages with things like invokeDynamic in the instruction set and let the higher level things take care of themselves.

More detail was then provided about what invokeDynamic is and why it is useful. Dynamic languages make it very difficult to figure out what the invocation sites are for your function calls. This is why scheme has only 5 and smalltalk only 1 (“methodsite”). “InvokeDynamic” is in one respect a slogan for this generic, late bound message sending.

There are some issues with this on the JVM we were told:

  1. Will JIT optimise it correctly / well?

  2. If you do optimise your invoke site, what does your path to it then look like:

    • Do you have a fast execution path (with a guard to catch situations when you (the JVM) are wrong)?

    • Or do you have slow execution path (in case something changes on the fast path) which you hope never changes?

However, the Hotspot JVM has lots of tricks to hedge bets on the fast path. This is not only a Java thing and all JVM languages can take advantage of it. However there is a missing piece in the bytecode which allows you to specify a more dynamic message site.

Microsoft have achieved this in the CLR with the “Dynamic Language Runtime” which is a set of bits on top of the standard CLR. This type of solution is already available in Java but invokeDynamic would allow other JVM languages to benefit.

At this point we ran out of time. One participant suggested that we set up a google group to continue this discussion. Charles Nutter offered to do this. To participate, send him and email (charles dot nutter at sun dot com) and refer to this session in the title.

Notes: Beyond Blogging: Feeds In Action Technical Session (TS-6029) at JavaOne 2007

Note: These are the notes which I took at the "Beyond Blogging - Feeds in Action" Technical Session at JavaOne 2007 (TS-6029) hosted by Dave Johnson. I will likely expand it with links and more information as time passes but for now I publish it in it's basic form. Please comment in the usual way.

Blogging has taken off over recent years. Thesedays everyone has a blog and more and more applications have a feed exposed. Everything with a time stamped, uniquely identified chunk of data with meta data anyway.
  • News stories
  • Search results
  • Uploaded photos
  • Events and meetings
  • Podcasts and vodcasts
  • Bug reports
  • Wiki changes
  • Source code changes
  • Log files
Meanwhile Web Services (WS) standards have "got uppity" and been evolving towards what some have termed WS-(Death Star)* aka WSDl, UDDI, schema etc al. However most developers didn't follow - developers prefered REST. This is because it is often best just to use XML and HTTP for Web Services. Now ATOM and RSS are merging as a foundation for simple Web Services. e.g. Yahoo Pipes, Lucene publishing using APP and the Eclipse Europe Distributed Build System.

So what is an RSS feed? It is a XML representation of discreet timestamped chunks of data with metadata available at a fixed URL which can be polled for updates.

Feed Attributes: id, title, link, date, author(s)
Item Attribites: id, title, date, author(s), category, summary, content

  • RSS (original) came out of Netscape in 1999. This was v.0.90 and was created by Dan Libby. It supported RDF and was known as "RDF Site Summary".
  • v.0.91. Dave Winer simplified things by removing RDF support (so "RSS" become "Really Simple Syndication"). (Later 0.9x formats are obsolete but still used today) A public spat between Libby and Winer occurs.
  • The RDF fork (RSS 1.0). One camp (Libby et al) wanted to put RDF back in. Winer et al wanted to keep it simple. RSS 1.0 put the RDF back in. This completely different standard provided a small set of elements augmented by RDF, and allowed for extension modules (e.g. Apple's iTunes module which provides metadata for song information.) This caught on as it was adopted by MoveableType, the first big blogging engine. RSS v.1.0 is still widely used today.
[Diagram: RSS 1.0 elements] - RDF, Channel, Items (NOTE: items are not in the channel element, unlike in RSS 0.9.x)
  • The Simple Fork - RSS 0.9.x continues. However Winer kept going with v.0.92, 0.93 and finally 2.0. These later releases added metadata and an element (allowing podcasting!). This was still completely incomaptible with RSS 1.x. However, To carry other kinds of data you could extend the format. This led to "Funky RSS" using extension elements instead of the core RSS. e.g Dublin core (dates with ISO 8104(?) format)
[Diagram: RS 0.9.x elements] - RDF, channel (contains the rest of the elements)]

RSS Limitations:
  • The spec is too loose and unclear - which fields can be escaped HTML?, how many enclosures are allowed per item?
  • The Content model is weak - There is no support fior summary and content and content-type and escaping is not specified
  • The specification is final and cannot be clarified
So what is ATOM? It is both a feed format and protocol to edit resources on the WWW. It is developed by IETF as RFC-2487. The protocol will be finalized in 2007.

The Feed format
In ATOM a feed contains entries which are time stamped, unique ID'd chuunks of data (a URL is a valid identifier for an item - think REST). These entry types can be any content type (binary data x/Base64 encoding) so as a result it's generic; its not just for blogging and podcasting (e.g. there I heard elsewhere at JavaOne that there are plans to use it to make server logs files available as feeds). ATOM feeds are longer than their RSS precedents as there are more required elements.

[Diagram: RSS and ATOM family tree]

Parsing and Fetching Feeds
RSS is just XMl so you can use your favourite parsing technique. There are many such as Abdera Apache, Python (universal feed parser), Windows RSS platform (Windows only)).

ROME is the most capable and widely used client and parser avaiable for Java. It is extensible and pluggable and is based on the JDOM parser (which means that if it is a large feed then there is lots of memory usage. This needs to be fixed). ROME is free and OSS under the apache licence. ROME supports 3 object models: RSS, ATOM and a bridging SyndFeed model (which can convert to and from the other two)

Be nice and conserve bandwith; use HTTP conditional get (or Etags) and keep a local copy. Don't poll too much dependent on the update speed of the feed you are polling. ROME does this for you with it's fetcher.

Producing Feeds with ROME - Tips
  • You can either use your favoutire XML tools
  • or use template languages (JSP)
  • or use ROME direct
Serving Feeds
  • Serve your feed up once its created. For example within a servlet. Make sure you use the correct content type (either application/rss+xml or application/atom+xml as applicable)
  • Cache cache cache! On client side via HTTP conditional GET, on proxy servers using the correct HTTP headers and on server side via your ROME application. E.g. in a servlet use LRUCache cache = new LRUCache(5, 5400); This is an in memory cache for feed items
  • If a feed or item has not been modified return 300 ("not modifed") response to HTTP GETs
  • Set the cache control header to tell proxies to cache for how long
Feed Auto discovery
Make it easy for others to find your feeds. Web browsers and others can simply find your feeds by hittin your page if you add a couple of links to the HTML header; put the content types supported (as above) with the feed title and URL.

Serving Valid Feeds
  • Ensure the HTML content within your feed XML is properly escaped
  • Ensure your XML is well formed
  • Use (It's OSS, written in Python and can be run on your desktop/server)

Publishing with ROME PROPONO
Propono is an API which supports publishing by feed publishing protocols.

Some history. first there was the Blogger Feed Publishing Protocol API - It was simple and didn't support all the required metadata. Then came the Metaweblog API which extended the Blogger API by adding RSS metadata. Now we have the Atom Publishing Protocol which again updated and replaced these. This is a REST based protocol.

The Metaweblog API
This allows you to connect to a server and have an API to do some operations to publish your post. e.g. getUserBlogs(), newPost(), etc.

ATOM Publishing protocol (APP)
Based on the ATOM feed format APP can do all Metaweblog API can but in a much more generic way. It allows you to manage collections of entries (which can be any form of data) on the web which can contain any kind of data e.g. CRUD entries. It is based on REST so HTTP verbs can be used for all operations.

APP Introspection
APP allows you to do an authenticating GET against the Endpoint URL which tells you what services are availble on the URI.

An ATOM collection feed
The collection of items returned may not be complete. In this case there will be a next and previous links so you can page through resutls effieicntly The server governs how big the chunks are returned.

Creating an Entry
If you create an ATOM entry and post to the collection URL the server will post back the result to you with the blanks filled in (it controls the namespace so generates URI's etc)

The Propono APP client library makes it easy to build an APP client. Likewise the APP server library makes it easy to add an APP server. The Blog Client library supports both the MetaWeblog and and APPAPIs.

The Future
  • There is now better RSS/ROME support in Java. Is it time for a JSR?
  • We will see more REST based WS in general. This is made easy by the REST API, Restlets, etc
  • We will see more WS based on ATOM using APP as a canonical REST protocol

More info
  • RSS and ATOM are not just for blogs
  • ROME has the tools you need to produce and consume RSS feeds

Monday, May 14, 2007

Project Wonderland BOF (BOF-1306) @ JavaOne 2007

These are my notes which I took during the Project Wonderland BOF at JavaOne 2007. Enjoy.

Paul Byrne - Lead of Wonderland
What is project wonderland?
- A technology for an immersive collabroative environment
- Allows distributed teams to work together
- OSS server and client side environment
- Security model to set up secure server - this allows you to trust the environment

The space available when you startup is a cubic light year

Key differences from the alternatives (i.e. Second Life):
- It has audio: high (CD) quality streaming audio which is distance attenuated and in stereo. They also have IM but here you can talk.
- You can run apps - unmodified. Firefox for example. We can now work with other people. Others can take over your appication and collaborate. Windows applications can be available too off a RDP client. However you need a dedicated server fo this. For X it can be the desktop you are working on. They demo this by pulling back from the presentation to reveal that the slideshow is just hanging there in a virtual JavaOne pavillion. We are taken on a tour and see the co presenters.

There are 3 main components:
1. Project Darkstar - The game server. Back end infrastructure. This is persistent and scalable.
2. Project Wonderland - The client UI or "browser" as it was described. Allows streaming geometries, audio, and access to desktop apps
3. MPK20 - An investigation of how to apply this tech to Sun. How can we use this to work tohegher. "Collocated-like"

Project Darkstar
- Open Source, enterprise grade, scalable online game server
- The programming model hides complexity of multi threading and server replication
- It handles persistence and state recovery in case of failure. Fault tolerant. No "Shard failure" probs
- It provides plug in APIs for extensibility
- It is platform and fame agnostic

Nigel Simpson - Sun labs researcher
Sun have been investigating social issues in the workspace and distributed teams. This is "MPK20" - 19 buildings in Menlo Pk campus. "20" is first virtual building. What works to bring people closer together? This is a place to do work and business. It ensures that they are socially and emotionally connected. MPK20 brings the virtual and real worlds together. It is not an alternate reality, just a merged one. Before, remote citizens were often second class citizens. Now this is lessened / removed.

What is the motivation? - There are increasing distances of separation within teams. This remoteness decreases opportunities for trust building relationships. Brainstorming is too difficult. Social engagement is a key motivator for cetrtain personality types. There are also management challenges - remote management is hard. Current tech solutions fail to address these issues

Concepts of MPK20 - it is a virtual office space including public spaces, social spaces, team spaces (e.g. compiling wonderland inside of wonderland, extreme programming, stuff on the walls etc.), individual work spaces, notes and screenshots and discussions on the walls. People can leave annotations (graffiti).

They also have plans to be able to leave a virtual voicemail - to pick it up you go back in time to when the caller left the message.

Comment from the audience: This is very Similar to the open croquet project - which was primarily a smalltalk environent. This is Java. The other difference from croquet is that it aims to foster ad hoc, peer to peer groups. This is corporate infrastructure. You want to be able to control and scale your server farm. It was invented so a game company could run multiple users (thousands) in a single game. You will see a lot of people doing a lot of metaverses - how do we make them all talk to each other. How to talk across metaverses? We are looking at it.

Mixed reality - The aim is to provide ways for virtual and real worlds to interact. Overlay virtual and physical and blur the boundaries. Build physical spaces that incorporate virtual interactions. Porta Person is an example of this - it provides an audio / video portal between virtual and physical worlds - virtual sees physical and vice versa. It bridges VR and real world conference attendees.

The Voice bridge - this provides real time, multi channel, high fidelity stereo and audio mixing. It is 100% java. Mature tech, part of Sun labs meeting suite telephone conferencing application. There is an OSS release of this in progress. It allows you to generate a private mix for each individual member (thereby mixing out their own audio). It also provides natural decay and rise of audio as you approach and move away from the source.

Other thoughts: What about playing with time? You could leave ghosts of yourself so that conferences or interactions could take place across timezones.

- Can I run it in an applet? - you should be able to but for performance the geos of the world are cached on the client. This would need to be looked at. however, you could just use it for access to smaller areas such as conference suites etc. Yes, that would work.
- Can I get a 2D or reduced bandwidth version? - there is no reason why not
- Can I use this to reify my server environment so that I can see and hear my distributed application operating? - Yes, we have been thinking about this. We could use motion and colour as well as many other cues like audio to show you how your app is performing. This is not there now.
- Can I get a holo deck? - [laughter] Not as mad as it seems

More Info

JavaOne 2007 Day One Keynote - Ubiquitous JVMs

These are the notes which I took during the opening keynote. I'm publishing them now and will add comments as and when I get time. At the moment, it's pretty much just a transcript of what was said. Please leave comments.

John Gage

John starts by investigation why we are here. What lies ahead in the next 81 hours? First some rules: Rule 1 – don't be shy. JavaOne is mentioned in today's New York Times (“about internet connected multi function devices”) We should think about every device in the world that can be controlled by software. He has 2 devices. The first is a SavaJe phone - the OS is totally Java. It is an internet-connected multi function device. Location data, form factors small to large, In the future costs will come down and we will have ubiquitous network access. We must bring the price point down. How? Open all parts of the device. He shows the second device – “off the grid on the net.” It is a solar device. Now we have distributed power generation. These are devices, It doesn't run java yet but it will soon. What can we do when we combine power and internet-connected multi function devices?

We are going to take these in volume to where communications have never been.

Rule 2: Forget where you are from; for the next 81 hours pretend you are Brazillian (cheers and flags being waved at the front – The Brazillians are here). When you sit down in a session, turn an introduce yourself and say what you are working on. Cross fertilisations will lead to new ideas and new companies. There are hundreds of new companies waiting to come into existence. Go to the effort to exchange an idea with someone.

Last year they promised to make the conference carbon-neutral. It turned out to be more difficult than they thought (though Richard Branson offered to offset all the carbon to get us all here.) We are at a point to measure everything together; to measure all energy inputs and outputs. Sun ask for ideas on how to do this. In the next year, as we take this even more seriously John predicts we will see a carbon offset price of 10-20-30 dollars / ton (it is currently $3/ton). We need the small devices to capture this information. It is our duty to make visible the invisible - our impact on the planet. These small connected devices are the vector to connect and to do this.

[Video: Montage of the impact of * without borders – the impact of java on all of our lives - “BE OPEN”]

Rich Green
We will hear from some people and hear where we are going. Seat belts on. Tray tables up. But what is the context? When you build the picture in your head what do communities mean to people? Communication is the vehicle for building communities. There are core elements which differentiate human beings. Whoever you are, when you light the bonfire. who ever they are you look in the fire. When you walk on the beach it touches the core of your human make up. Humans don't have to communicate – they need to. The video we saw shows that. But there are boundaries which limit or mitigate this: Language, borders, culture. But those barriers are falling. Use technology as a catalyst. This is a vehicle for communication. How can we further enable the network as an unstoppable force to facilitate this core tenet of what makes us human? Mobile phones out shipped the network 20 to 1. Think about how we communicate.

Its a year since he came back to Sun. Java being OSS was announced in Nov 2006. Numbers: 6M developers, 5.5 Billion devices (2 Billion are mobile handsets) 200m million Glassfish downloads. TV's 11 M. 1.8 Billion phones. Where are we going? Java EE and Glassfish. Java on the server is stronger than ever. 7 companies are shipping it. Oracle and apache are also adhering to the EE5 spec. v3. is about to come out. Glassfish is an OSS enterprise ready application server. It it time to change the game. People are fixated on it being an enterprise transaction system. Use the fundamental server tech as a server side tech. Power communications to people.

Martin Harriman from Ericsson (VP marketing and business dev) – Ericsson are partnering with Sun. They have open sourced their telcomms multimedia technology to drive development of IMS and run it on Glassfish. It will be known as the “Sun Java System Communications application server.” It will facilitate communications (voice, SMS, etc) to mobile devices by leveraging servlets. We need your help to develop the ecosystem around our IMS technology.

[Video - My opinion: It looks like slingbox, + twitter + iPhone.]

Real Time Java
Finance, telecommunication, aviation, industrial control and more. It used to be JSR 1 – now it's real. Real time Java is out (java.lang.Thread -> javax.lang.RealtimeThread) and provides real time with conventional tools. It is running on 800 plus devices and hooks into OS's such as Solaris. Move the world into real time programming,

Annie Ewing (CIO of NASDAQ) – How they are using real time in the exchange. Started 21 years ago when SUNW listed. Their trading platform runs on Java. They pioneered electronic trading. They transact 150378 transactions per second. This is done at sub millisecond speeds. Speed is important. But you also must react to unpredicted events with certainty. What are the next steps? We working with Sun to prototyping the next gen platform to run on real time java. There is a toolkit it provides including improved memory management and thread control and also easy migration.

Java and Digital Entertainment
Blu Ray brings Java to everyone. 70% of all HD disks sold so far are Blu Ray.

Tom Holman. VP of Production Operationss at Sony Pictutres Digital authoring centre. Java will bring interactivity. It will allow online connectivity. It will allow the studios to do what they want to. Generate more money. Java is futureproof and now films will be too. You will buy Spiderman 3on BluRay DVD – the trailers will stay up to date.

Demo: POC of “Open Season” DVD menu. The butterfly is following a random path to the menu item we select. It is a graphical animation. You could't do this with the old disks. Online connectivity is the next big thing. It is only the skills you have which will hold you back. Hollywood will be looking for Java developers.

Netbeans 6
There were +92% active Netbeans users year on year. Netbeans 6 provides JRuby and Java support. There's Matisse eith Beans Binding and Swing Application Framework. There's a robust new editor. There are modular new packs for Enterprise development, C++, and mobile application development.

OSS Java
In the past we OSS'ed Java. This has today been completed. OpenJDK is done. (Not totally correct - Chet Haase said in the JavaPosse BOF that there are still come elements which cannot be opened - these are in Java2D) It is available and buildable. How best to access and program it? – Sun have added modules to Netbeans. They are also driving community development. There is an interim Governing board in place (Doug Lea, Mark Reinhold, Fabiene Nardon, Dalibor Topic and Simon Phipps) and they will be creating the constitution and holding elections. This will form the first steps for the community.

TCK – Sun are making available the stand-alone TCK to the community. This will remain compatible. The plan is to get as many people access to the TCK as possible, There will be access to the Java brand after successful TCK certification.

GPLv2 – Why? Compatibility is critically important. This helps to maximise and manitain this. Licence compatability is also important. Now Java bundles easily with core Linux distros. (e.g. Ubuntu Feisty Fawn with Netbeans) This will maximise distribution.

"We are done open sourcing java"

Open -> equal opportunity. More contribution and more innovation. Where do we take Java next? There are some things we could have done better. We have spent a lot of time listening, “We want more.” Reach humankind. This is the time to reach the rest of the planet. Some call them consumers, we like to call them “people”

Faster faster faster. We want Java to go faster. In spring we will announce a series of updates to SE 6. It will be faster to download and faster to execute. The fastest Java SE ever.

Also we want to take advantage of Java and its reach (it is everywhere). There will be a new focus on media: JavaFX. Consumer focussed family of tech. This will allow Java to be used in high impact consumer markets requiring visually rich applications. Java FX will allow you to create visually impactful experiences using java and other forthcoming languages. All will be based on standard Java SE. The first component is Java FX script; a scripting language for Rich Internet Apps. There will be roadmaps for tools designed for content professionals. “Designed for everyone else”. There will be a focus on communication which leverages Java platform itself.

JavaFX Script – James Gosling and Chris Oliver
Swing and Java 2D – Demos

All swing and Java 2D scripted. Copy of a Motorola site. Done in 3 days. It used to be hard and take a long time. Reach out to the next ring of creative individuals.

[Opinion: Looks like a FLEX app.] There is OpenGL acceleration. Image scaling etc. It is really simple and is released and out there now. This is a preview. We want feed back. Where is the tool? Coming soon. Not there yet. It is planned to build a complete line of content creation tools for design professionals. Also integrate it with all flavours of Java. Sun are trying to maKe the development experience as cohesive as possible

JavaFX runs on every Java SE platform unmodified. Everything out there will run it.

But wouldn't it be cooler if we could build a software system to reach everyone else...

JavaFX Mobile
This brings the SE environment to everyone on earth. The network in your hands. This is a demo running on a SavaJe phone. It is a complete desktop scale operating environment in your hand. Java OS. Now the entire power of Java SE is availale to everyone on earth. Open programming platform. Made available to OEM's worldwide. This is breaking apart the hardware and the software.

Nandini Ramani – demo. PDAs smart phones and feature phones. The feature phone runs Opera. It can multitask and has the rich JavaFX graphics we just saw. It can access all the Java SE code,

Marco Boerries – Senior VP of Yahoo! - yahoo go! Yahoo! want to connect to their 500 million subscribers. We don't want the internet from browsers to mobiles. Instead we want to use the internet as a backbone to deliver to mobile devices. Today running on 200 phone models is Y! Mobile search. It provides full mapping and driving directions. News (not only from Yahoo – can use any news via RSS) Weather, My Photos (Flickr) You can now use the mobile phone to capture and consume. Designed as an open system. They will open it to all developers later on the year. They will allow ME developers to plug into one search. Also runs on JavaFX mobile.

Jonathan Schwarz
Let me give an example why this is important. Consumers are making a profound impact on the enterprise. Take Google for example - you don't ask you CIO if you can use it. Businesses want to connect with people. Where do they go? They will go to the devices. Most of the internet today uses the handset as a vehicle to interact with it.

Governments like the GPL licence. The network has utility and creates value. They want the lowest friction licences.

Dr. Djibril Diallo. United Nations, New York Office of Sport for Development and Peace

Sun are announcing “Engineers Without Borders” - working with the UN to make connections between leaders. Take the software we talked about today to create economic opportunity and social opportunity for those who connect to the internet.

Scott McNeally
K-12 content available for free –

Monday, May 07, 2007

JavaOne 2007 (Day 1 – CommunityOne) Keynote with Tim O'Reilly

Update: Tim Expands on a lot of the topics he introduced in this Keynote in a podcast from EdTechLive 2007.

Tim starts and says that his first Open Source talk was in 1997 about the community aspects of open source. He talked about the history of the IBM personal computer and what we could learn about the shape of innovations - the open source paradigm shift

He asks how many in the room use Linux? How many use of us in the room use Google? He points out that this is one of the most widely used Linux applications but is not Open source. Technology has moved in some way. What does that mean? What does this mean in the context of the web? What are the killer apps of the internet? What do they all have in common? They all have the network as the platform. Sun were ahead of their time with the tag line “the network is the computer” (John Gage) They spotted the “network effects” phenomenon. These days most sites are built on Linux or free BSD. Few are open source. (Live Journal only) They are services and not packaged applications. They are data aggregators. He says he had a big argument with Richard Stallman about this. Tim's point was that if you had the source for Google you still couldn't run it. It's a set of servers, processes, and the data. These are big changes. This is a return to theme of community. Network effects for user contribution are the power these days. So what drives them?

This led Tim to web 2.0. He says that the focus on s/w licensing was a red herring. What mattered more is a modular architecture (Web Services) and innovative collabrative development using new tools. Users re now contributors. Web 2.0 companies use this in new ways. Alpha geeks showed the way.

So what does Tim mean by “Web 2.0?” He says it is like the “law of conservation of attractive products” (Clayton Christiensen)

Firstly the value moved from h/w to s/w. IBM didn't realise it and lost out to Microsoft. This is the world we grew up in. Dell are the best exemplar of how the h/w layer is now commodity. Intel could carved off a proprietary piece of this stack as did Microsoft.

So we move up the stack. Did it go to Linux and Open Office? No, instead the pattern repeated. Now s/w components have become commodity but there is still a system level lock in: proprietary info. What makes google so powerful? What makes all these new companies so powerful? It is not community per se but the design of theirsystems to harness network affects to get better the more people use them. Google's pagerank was the breakthrough in this.

Take craigslist as another example. It is built through user self interest. It is the 7th most traffic-ed site on the internet with but only has 25-26 employees.

Web 2.0 = “Bionic software” Now companies are leveraging the 6 million-human computer. It is all about building s/w powered by people. Think about Flickr and the tag cloud. This is a UI element generated dynamically solely by the users using it. and digg too are powered by people. Compare digg vs wired news in site hits. Digg blows past them very early on in its life. Similarly LastFM don't ask you to do anything. You install their plugin and it listens in on your listening habits. They are instrumenting your PC. Pandora tried the same kind of thing with free music but they did this by analyzing you the user's likes algorithmically. This is not as good as simply looking at what you do.

This is all about the cornucopia of the commons. These companies are building on top of Open Source. Yahoo pays folks to build their directory. Wikipedia is another example. They harness the self interest and automatic behaviour of their users. They have an architecture of participation.

They use this to build massive databases. Google maps uses Navteq. They (Navteq) spent the money getting the map info. They are an example of the “intel inside” of the web 2,.0

There is also the concept of the “perpetual beta” (which Microsoft call “live software”) They all grow dynamically. “How cool is it that I can finish it tonight and push it live to the world tomorrow”. This is the converse to shipping the CD. Rails and Spring have helped this. Few people can build these sites quickly. Think of the two-pizza teams in Amazon. There is a real critical need for instrumentation and live feedback.

Tim closes with some questions for Sun:

  1. How do you help developers in this new style of dev to harness collective int.

  2. How do you help them create “live software”

  3. How do your thinking about OS and open standards in the context of data lock in?

Tim Bray – I have a problem with the terminology. It's not “content” It's my life. This is a symptom of an attitude problem in Web 2.0.

Tim O'Reilly – But users do generate that data. These are changes that are profound. Lots of us don't like the names, but there is something going on. If your system doesn't get better the more people who use it, you have a problem. This is really powerful.

Rich Green – There is a gradient to this which we feel less confident in defining. What about the phone? When we're on the phone are we chatting? Or are we generating content?

TO – But lets think about how would a phone company work if they were Google? And what if Google were the phone company? Tim elaborates on this in his blog post "What would Google Do?"

RG – Is the difference the storage of the data?

TO – So how do you make it easier for authors to generate their own mashups? How will Sun do that. Todays it's the experts who do it. It needs to get easier.

TB – I spoke to some bankers in Canary Wharf in London last week. He went in with a Web 2.0 message. As Bill Joy said, the smartest person is always somewhere else. He is not in the room with you. You (the big banks) need to join this info revolution. This is a phenomenon that is important for business, not just for the users out there.

Ian Murdock – As Jonathan Schwarz said a year ago – computers are not the commodity, it's the computing.

TO – Johathan was right. But Sun offered it and no one took it. Amazon offered it for 0.0x cents and they took it. The margins are getting tight in this area.

IM – Sun needs to go after the developer to get in that way.

TB – There is another effect. The degree to which you need to be a rocket scientist to make a contribution has come down but you still need to reduce the friction and the barrier to entry.

TO – I totally agree. Now you can contribute without being a programmer.

RG – Access is a problem. This is a big priority for Sun.

Audience questions:

Q: “Is there a limit to what Sun will open source?”

RG – Everything (edge cases aside) Open sourcing our IP under licenses conducive to sharing and community is good. More eyeballs = good. This is our business model. We are working through getting everything out there.

Q: “What is web 3.0 likely to be?”

TO - To me this is a meaningless term. Most transformative changes will be when we stop typing. This is not just speech interfaces (Google are offering 411 services to get better at speech, not to get into telephony) Gestural interfaces will be big (Wii), and lots of instrumentation (e.g. Insurance companies billing on your for your insurance based on the info of your car's location and speed.) Our computers will start to learn from us not from just what we tell them explicitly.

TB – It is very hard to road map the web side. I don't know what it's going to be but I know it will be surprising?.

Q: “What is the future at Sun for Java and other languages on the JVM?”

RG – People associate the JVM and java as the same thing. They aren't. JRuby has been big for the past year. There are 100+ languages on the JVM. We are adding a lot more. Pioneering steps are to be announced to bring far more indviduals into the fray. This is a very active play for us right now.

TB – Languages in their native form are not be blown off too (e.g. Ruby and Rails.) What runs on which VM is not that important. Loving the developer is the big thing

IM – As developer platforms of choice are moving up the stack, are the Operating Systems still as important? This week we are going to talk about “why the OS matters” The layer of abstraction is great until you need to see what goes on underneath.

TB – I would impress on us to see what we can learn from Wall Street. The first clicks are becoming the battle ground. Google and Yahoo are trying to give you your results inline in the results page. You don;t need to even go to the actual linked site to get your info. The massive databases will fight for who gets the user. The game is far from over but it is the game.

Q: “Flash and Heroic Attempts in Ajax vs Java?”

RG - Come back tomorrow...